[CTreeCtrl] popup menu does not display correctly - Programmer

This is a discussion on [CTreeCtrl] popup menu does not display correctly - Programmer ; Dear All, I want to display a pop-menu when I right-click a a node in the tree. I use the following code inside my handler: POINT p; GetCursorPos(&p); CMenu menu; menu.LoadMenu( IDR_MENU1 ); menu.TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON, p.x, p.y, this ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [CTreeCtrl] popup menu does not display correctly

  1. [CTreeCtrl] popup menu does not display correctly

    Dear All,

    I want to display a pop-menu when I right-click
    a a node in the tree.

    I use the following code inside my handler:

    POINT p;
    GetCursorPos(&p);
    CMenu menu;
    menu.LoadMenu( IDR_MENU1 );
    menu.TrackPopupMenu( TPM_LEFTALIGN | TPM_RIGHTBUTTON,
    p.x, p.y, this );

    The problem is now that the menu shows up a thin vertical line; only
    submenus shows up correctly in their full width.

    What am I doing wrong?

    Thanks

    Thorsten

    PS: I'm using vc7.1 in case that matters

  2. Re: [CTreeCtrl] popup menu does not display correctly

    >I want to display a pop-menu when I right-click
    >a a node in the tree.
    >...
    >The problem is now that the menu shows up a thin vertical line; only
    >submenus shows up correctly in their full width.


    Thorsten,

    Try it like this:

    menu.LoadMenu( IDR_MY_CONTEXT_MENU );
    CMenu * pop;
    pop = menu.GetSubMenu(0);

    UINT uCmd = pop->TrackPopupMenu( TPM_LEFTALIGN |
    TPM_RIGHTBUTTON, p.x, p.y,
    pMenuParent, NULL );

    Dave

  3. Re: [CTreeCtrl] popup menu does not display correctly

    David Lowndes wrote:
    >>I want to display a pop-menu when I right-click


    > Try it like this:
    >
    > menu.LoadMenu( IDR_MY_CONTEXT_MENU );
    > CMenu * pop;
    > pop = menu.GetSubMenu(0);
    >
    > UINT uCmd = pop->TrackPopupMenu( TPM_LEFTALIGN |
    > TPM_RIGHTBUTTON, p.x, p.y,
    > pMenuParent, NULL );


    Thanks. It works.

    -Thorsten

+ Reply to Thread