Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Work Area on PocketPC square emulator

156 views
Skip to first unread message

dev15

unread,
Jun 7, 2007, 5:22:13 AM6/7/07
to
Hi, I have a PPC C++ app which dynamically sizes a dialog box and associated
controls
depending on the device screen size. I am using the SystemParametersInfo
with SPI_WORKAREA
flag to get screen sizes. However i am finding on PocketPC Square emulators
the work area
doesn't seems to include the menubar at the bottom so i end up with the menu
bar covering the
controls at the bottom of the screen.

How can i resolve?

Thanks


Michael Salamone

unread,
Jun 7, 2007, 8:13:18 AM6/7/07
to
A few options:
- Change the dialog layout to take this information into account
- Use the workarea to dynamically change the position of the controls so
they are positioned inside the workarea
- Add a scrollbar to the dialog so the user can scroll to those controls

--
Michael Salamone, eMVP
Entrek Software, Inc.
www.entrek.com


"dev15" <de...@gmail.com> wrote in message
news:uGUKXVOq...@TK2MSFTNGP04.phx.gbl...

r_z_...@pen_fact.com

unread,
Jun 7, 2007, 3:20:05 PM6/7/07
to

I decrease the height of my dialog boxes by the size of the menu bar.
For Smartphone, that seems to be 26. I haven't posted the code for my
Maximize function in a while, so here it is. I left it intact,
complete with references to some little functions of mine; their
purpose should be clear enough so I won't bother providing the source.
I'm sure I've posted source for PFWTaskBarSetVisibility, so I won't
bother posting it again. In other words, you may need to work a bit to
get this working and/or to understand it, but it _is_ real code that I
use often.

// ----------------------------------------------------------
// Maximize
BOOL ClsPFWindow::Maximize( BOOL bRedraw, BOOL bFull, BOOL bHideMenu )
const
{
// TODO: See Mark Davis comment
(microsoft.public.windowsce.embedded.vc
// 19 Oct 00) that SystemParametersInfo is a bit unreliable, and
the
// "rect isn't always what you'd expect"
TEST_VALID( PFWHwndCheck( m_hWnd ) );
// SW_SHOWMAXIMIZED not defined for CE!!!!!
// Actually, it _is_ defined for CE 2.11 and 3.0 (6 Aug 03)

#if 0 && defined( FOR_Smartphone2002 )
// Adapted from PPCCur sample in Smartphone 2002 SDK 4 Mar 04
(4.0.0.57)
//lint -esym( 715, bRedraw, bFull, bHideMenu )
SHINITDLGINFO shidi;

shidi.dwMask = SHIDIM_FLAGS;
shidi.dwFlags = SHIDIF_SIZEDLGFULLSCREEN | SHIDIF_SIPDOWN;
shidi.hDlg = GetHwnd();
return ::SHInitDialog( &shidi );

//#elif 1 && defined( FOR_PocketPC )
#elif 1 && (defined( FOR_PocketPC ) || defined( FOR_Smartphone ))
// 31 Oct 03 (4.0.0.31)
//lint -esym( 715, bHideMenu )
RECT rWork;

#if defined( FOR_Smartphone )
if (bFull)
rWork.top = 0;
else
VERIFY( ::SystemParametersInfo( SPI_GETWORKAREA, 0, &rWork, 0
) );
#else
if (bFull)
{
rWork.top = 0;
// ClsPFRoot::BitSet( eHideTaskBar, TRUE );
}
else
{
// Leave room for Task Bar at top
#if 0
HWND hWT = ::FindWindow( _T( "HHTaskBar" ), NULL );
#else
// 17 Feb 05 (7.7.0.22)
HWND hWT = PFWTaskBarFind();
#endif
ASSERT( PFWHwndCheck( hWT ) );
VERIFY_EXPLAIN( ::GetWindowRect( hWT, &rWork ) );
// Next line sets top of this window to bottom of Task Bar
rWork.top = rWork.bottom; // slick reuse; bottom and
others will be reset below
// ClsPFRoot::BitSet( eHideTaskBar, FALSE ); // disabled 17
Feb 05 (7.7.0.22)
}

rWork.right = ::GetSystemMetrics( SM_CXSCREEN );
// Bottom will be used as height in ::MoveWindow
rWork.bottom = ::GetSystemMetrics( SM_CYSCREEN ) - rWork.top;
rWork.left = 0;
#endif

// Leave room for ToolBar (menu) at bottom
// if (!CheckRootBits( eHideMenuBar ))
#if !defined( FOR_PocketPC ) && !defined( FOR_Smartphone )
#error How is this be valid (9 Mar 06)?
// Not for PocketPC or Smartphone 14 Sep 05 (7.7.0.47)
// Revert 12 Sep 05 (7.7.0.46) definitely needed for Dolphin 7400
if (!bHideMenu)
// rWork.bottom -= 26; // see ClsPFCommandBar::GetHeight
#if 1
// revert 28 Nov 05 (7.7.0.50) (TODO: Fix problems)
rWork.bottom -= g_kiMenuHeight;
#else
// 28 Nov 05 (7.7.0.50)
rWork.bottom -= ClsPFCommandBar::GetHeight();
#endif
#elif 1
// Revert 28 Nov 05 (7.7.0.50) - problems with GetHeight
(TODO: Fix problems)
// removed test for bHideMenu 27 Jan 05 (7.7.0.17)
// rWork.bottom -= 26; // see ClsPFCommandBar::GetHeight
rWork.bottom -= g_kiMenuHeight;
#else
// 28 Nov 05 (7.7.0.50)
rWork.bottom -= ClsPFCommandBar::GetHeight();
#endif

if (m_hWnd != ::GetForegroundWindow())
VERIFY_EXPLAIN( ::SetForegroundWindow( m_hWnd ) );

// According to on-line help for SHInitFullScreen, window must be
resized _before_
// setting Task Bar visibility, and BZ found that to be true
TEST_VALID( ::MoveWindow( m_hWnd, rWork.left, rWork.top,
rWork.right, rWork.bottom, FALSE ) );

TEST_VALID( PFWTaskBarSetVisibility( !bFull, m_hWnd ) ); //lint
!e730 boolean arg

if (bRedraw)
VERIFY_EXPLAIN( ::UpdateWindow( m_hWnd ) );

return TRUE;

#else
//lint -esym( 715, bHideMenu )
// 2 Jun 03 (4.0.0.9)
RECT rWork;
VERIFY( ::SystemParametersInfo( SPI_GETWORKAREA, 0, &rWork, 0 ) );
if (bFull)
{
rWork.bottom = ::GetSystemMetrics( SM_CYSCREEN );
IGNORE_RETURN( PFWTaskBarSetVisibility( FALSE ) );
}
else
{
IGNORE_RETURN( PFWTaskBarSetVisibility( TRUE ) );
}

// Need to resize window _after_ showing/hiding taskbar
return ::MoveWindow( m_hWnd, rWork.left, rWork.top, rWork.right,
rWork.bottom, bRedraw );

#endif

} // Maximize


>
>Thanks
>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
20 Park Plaza, Suite 478
Boston, MA 02116
www.penfact.com

0 new messages