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

CMenu::TrackPopupMenu - strange behaviour.

81 views
Skip to first unread message

Damian Powell

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
Hello everyone,

I'm using the following code to display a popup-menu from a CDialog
derrived object but it doesn't seem to work correctly.

When the menu is displayed, it appears as a thin-ish vertical line with
no text. However, the highlight does move as I move the mouse down the
menu and the correct menu items are selected from the various positions.

Can anyone tell me what I am doing wrong?

void CRs232ClientDlg::OnRButtonDown(UINT nFlags, CPoint point)
{
CDialog::OnRButtonDown(nFlags, point);
ClientToScreen(&point);
CMenu menu;
menu.LoadMenu(IDR_MENU1);
menu.TrackPopupMenu (
TPM_LEFTALIGN|TPM_LEFTBUTTON,
point.x,
point.y,
this
);
}


Thanks in advance,
Damian.

Sent via Deja.com http://www.deja.com/
Before you buy.

Douglas Peterson

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
There may be an "appropriate" solution, I don't know, but this works:

Create your menu (IDR_MENU1) with a single popup menu item (sub-menu)
and put the "real" popup as items in this sub. Then get the menu like
this:

menu.LoadMenu(IDR_MENU1);
CMenu* pPopup = menu.GetSubMenu(0);
pPopup->TrackPopupMenu(...)

Bob Moore

unread,
Oct 18, 1999, 3:00:00 AM10/18/99
to
On Mon, 18 Oct 1999 15:42:39 GMT, Damian Powell wrote:

>When the menu is displayed, it appears as a thin-ish vertical line with
>no text. However, the highlight does move as I move the mouse down the
>menu and the correct menu items are selected from the various positions.

You've loaded a bar menu rather than a popup.

--
Bob Moore [MVP]
http://www.mooremvp.freeserve.co.uk
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Due to an unreasonable amount of queries, I no
longer answer unsolicited email questions. Sorry,
no exceptions, and yes, this DOES mean you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

RealRookie

unread,
Oct 19, 1999, 3:00:00 AM10/19/99
to
How about using TPM_RIGHTBUTTON instead of TPM_LEFTBUTTON?

0 new messages