Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » TPMX_ ALIGN Collapse All
Subject Author Date
Bart Kampers Jun 5, 2009 - 2:28 AM

What is the purpose of TPMX_LEFTALIGN, TPMX_TOPALIGN etc. in CExtPopupMenuWnd::TrackPopupMenu. I cannot see any difference when using either of them?


I want the right margin of the menu to be at the given y coordinate.

Technical Support Jun 5, 2009 - 11:44 AM

If your code does not specify any TPMX_***ALIGN flags, the popup menu selects these flags automatically depending on free space on the screen relatively to the tracking point and exclude area rectangle. The TPMX_***ALIGN flags require non-empty exclude area. How to test this flags? The DRAWCLI sample application shows context menu in the selection mode over the graphic objects drawn on the view surface. This menu is displayed in the CDrawView::OnContextMenu() method:

   VERIFY(
                        pPopup->TrackPopupMenu(
                                    TPMX_OWNERDRAW_FIXED|TPMX_HIDE_KEYBOARD_ACCELERATORS,
                                    point.x,
                                    point.y
                                    )
                        );

This code snippet should be modified if you want to see this menu right aligned:
CRect rcExclude( point, point );
            rcExclude.InflateRect( 3, 3 );
            VERIFY(
                        pPopup->TrackPopupMenu(
                                    TPMX_OWNERDRAW_FIXED|TPMX_HIDE_KEYBOARD_ACCELERATORS|TPMX_RIGHTALIGN,
                                    point.x,
                                    point.y,
                                    &rcExclude
                                    )
                        );

The TPMX_RIGHTALIGN makes menu right aligned, but it does not work without the rcExclude rectangle parameter specifying non-empty rectangle.