Popup menu problem

This is a discussion on Popup menu problem within the Windows Programming forums, part of the Platform Specific Boards category; Hi. In my application I have a list view in report mode. I want when the user does a right ...

  1. #1
    Registered User
    Join Date
    Sep 2003
    Posts
    87

    Popup menu problem

    Hi.

    In my application I have a list view in report mode. I want when the user does a right click on an item from the list view to open a popup menu. The menu works, but it doesn't show properly(it is dysplayed very narrow, so the text is not shown, but I can choose a command from it and the message handler is called).
    Code:
    void CKasaDBDlg::OnRclickMainListview(NMHDR* pNMHDR, LRESULT* pResult) 
    {
    	// TODO: Add your control notification handler code here
    	CMenu theMenu;
    	theMenu.LoadMenu(IDR_MAIN_LV_MENU);
    	theMenu.AppendMenu(MF_STRING | MF_ENABLED,ID_MAIN_LV_DELETE,"Delete");
    	theMenu.TrackPopupMenu(TPM_RIGHTBUTTON,500,500,this);

    Any suggestions are appreciated.

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    Try this:

    Code:
    CMenu theMenu;
    theMenu.LoadMenu(IDR_MAIN_LV_MENU);
    CMenu *pPopup = menu.GetSubMenu(0);
    CPoint point;
    GetCursorPos(&point); 
    SetForegroundWindow();
    pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON,
    		point.x, point.y,AfxGetMainWnd());

  3. #3
    Registered User
    Join Date
    Sep 2003
    Posts
    87
    Thank you, bithub.

    Now it works.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Menu problem involving structs
    By NyHoK in forum C Programming
    Replies: 5
    Last Post: 03-31-2009, 10:00 AM
  2. Popup Menu
    By Ti22 in forum Game Programming
    Replies: 1
    Last Post: 01-18-2005, 03:46 AM
  3. Window - Menu problem...
    By FromHolland in forum Windows Programming
    Replies: 1
    Last Post: 02-26-2004, 02:49 PM
  4. MDI and MENU Problem
    By Marc in forum Windows Programming
    Replies: 3
    Last Post: 02-21-2004, 05:59 PM
  5. menu check problem
    By SuperNewbie in forum Windows Programming
    Replies: 5
    Last Post: 11-22-2003, 05:34 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21