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.