Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We know every menu item will have a checkbox associated with it.

I have a trend control. When ever the user right clicks on it i will load a menu. the loaded up menu will have a main menu (menu1), and a sub menu (menu2) in it. i used TrackPopupMenu function to track both the main menu (menu1) and the submenu (menu2)

cmd = TrackPopupMenu(menu1->GetSafeHmenu(), TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, NULL, m_ScrollBar.GetSafeHwnd(), NULL);
Switch cmd:
{
}

My menu1 has two item 1.)Properties and 2.)Submenu (menu2)
My submenu (menu2) has 4 items
1.)Pen1
2.)Pen2
3.)Pen3
4.)Pen4

When ever the user selects any one of the 4 pens, the pen on the trend resizes. Everything is working fine. Now the user can resize more than one pens at the same time. So now i added a 5th item to my submenu (menu2) and wehneevr the user clicks on the 5th items then only the pens resizes.

Well my idea is, if user clicks on pen1 or pen2 or pen3 or pen4, those menu items checkbox will be enbled or disabled every consecutive times, and when he clicks on 5th item the pens resizes depending if their checkboxes(pen1 or pen2 or pen3 or pen4) are checked or not.

As far as i know clicking on amneu item is one shot. When i click on pen i am checking it, but the menu disppears. If i call the TrackPopupMenu with a different cmd i can see the menu again with the checked box,

cmd2 = TrackPopupMenu(menu1->GetSafeHmenu(), TPM_LEFTALIGN | TPM_RIGHTBUTTON | TPM_RETURNCMD, point.x, point.y, NULL, m_ScrollBar.GetSafeHwnd(), NULL);
Switch cmd2:
{
}


but if user clicks again the whole menu disappers again. My question is is there anyway that there is a multiple selcetion menu item instead of one shot, is there any other way we can do this?

Experts help me please!!
Posted

Instead of showing a menu, you probably want to show a dialog. A menu is indeed 'one shot'. What I mean is, a frameless dialog can be made to look like a menu, but act the way you want.
 
Share this answer
 
v2
Comments
amarasat 25-Aug-10 17:35pm    
Thanks for the answer, i will do that.

A frameless dialog would be perfect, but i have a question, as soon as i jump into my dialog is there anyway that i can still showup menu1 on the trend control. I mean is there any option or style that shows the menu1 until the whole operation completes.

Sorry for such a lame question!!
A dialog as Christian suggested might work, but I would have chosen an ownerdrawn toolbar or listview control directly instead.

Check out the Classic Shell[^] article, and read about the classic start menu.
 
Share this answer
 
v2
Comments
amarasat 30-Aug-10 11:35am    
I created a dialog as suggested by christian, Is there anyways we can edit the LTEXT field of a dialog dynamically

LTEXT "Select From Available Pens",IDC_STATIC,6,5,100,8
Niklas L 30-Aug-10 16:25pm    
You will have to change IDC_STATIC to something else, say IDC_LABEL. Then something like
HWND hwnd = ::GetDlgItem(IDC_LABEL);
::SetWindowText(hwnd, "New label");

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