Click here to Skip to main content
15,895,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everyone,

I am having a SDI view application,in that i am displaying a custom popup menu in RButtonDown.Now my question is ,can i accses the data in that menu,means i need to get the selected data from the list (popup menu) and place it in the view.I need some assistance..

Shiva..
Posted

1 solution

Do you mean the title (string) of the selected item ? :)

OK.

resource.h
#define IDS_RED         10000
#define IDS_GREEN       10001
#define IDS_BLUE        10002
 
#define IDR_POPUP_COLOR 20000


yourapp.rc
STRINGTABLE
    IDS_RED          "Red"
    IDS_GREEN        "Green"
    IDS_BLUE         "Blue"
BEGIN
END
 
IDR_POPUP_COLOR MENU 
BEGIN
    POPUP ""
    BEGIN
        MENUITEM "Red",          IDS_RED
        MENUITEM "Green",        IDS_GREEN
        MENUITEM "Blue",         IDS_BLUE
    END
END


yourview.cpp
BEGIN_MESSAGE_MAP(CYourView, CBaseView)
  //{{AFX_MSG_MAP(CYourView)
  ON_COMMAND_RANGE(IDS_RED, IDS_BLUE, OnColor)
...
  //}}AFX_MSG_MAP
END_MESSAGE_MAP()
 
void CYourView::OnColor(UINT uiColorID)
{
  CString cszResult;
  cszResult.LoadString(uiColorID); /* :) */
}
 
Share this answer
 
v5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900