![]() |
|
#1
|
|||
|
|||
Popup menuHi,
I'm trying to open a popup menu using mouse right click. I'm using the following code to do so but the menu returnes as null. The code: CMenu menu; menu.LoadMenu(IDR_MENU); CMenu *pPopup = menu.GetSubMenu(0); ASSERT(pPopup); pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, 20, 20, AfxGetMainWnd()); "pPopup" always returnes as null. Any explanations? Thanks, Gabi |
|
#2
|
||||
|
||||
|
Quote:
try changing this: pPopup->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON, 20, 20,this); __________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#3
|
|||
|
|||
|
Thanks for the reply.
My problem occurs earlier. I get the null after the line: CMenu *pPopup = menu.GetSubMenu(0); Gabi |
|
#4
|
||||
|
||||
|
Quote:
well then the code is fine in my view, the problem might be when u create the menu in the resource, check this guidline when creating the menu: Quote:
__________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#5
|
|||
|
|||
|
What do you mean by: "add all of the menu items in the first drop down on the menu"?
If I have the following menu Items: "one", "two", "three" and so on. Do I put "one" at the head of the first drop down, Define it as popup menu (which means it does not have id) and put "two", "three" under it as non popup menus? Thanks, Gabi |
|
#6
|
||||
|
||||
|
Quote:
Here is a picture shows how to do it: __________________
When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free." Linus Torvalds |
|
#7
|
||||
|
||||
|
Quote:
Nope. You should put something else at the top of the menu - for example "Numbers" - this will be with the "Pop-up" option selected, and put "one", "two", "three" in this drop-down == "add all of the menu items in the first drop down on the menu" It probably returns NULL because "one" is a normal item inside the popup. Suppose you set the ID of the "one" item to IDC_ONE: Code:
If you get the message box, it means you did it wrong 8-) (the code checks if you set the first item to non-poup). Regards, Luci __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#8
|
||||
|
||||
|
Oooups, sorry Max Payne, when I began replying, I didn't see your post (the page didn't refresh).
The picture is realy worth a thousand words ![]() __________________
Please read these Guidelines before posting on the forum "A person who never made a mistake never tried anything new." Einstein |
|
#9
|
|||
|
|||
|
Thanks Max Payne and LucyWiz,
This solves my problem. Gabi |
Recent GIDBlog
Welcome to Baghdad by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| is that possible to create a popup that... | stevewatt88 | Web Design Forum | 3 | 02-Sep-2004 10:14 |
| javascript menu | dopee | Web Design Forum | 7 | 30-Jul-2004 23:22 |
| how to block the popup adverts / destroyads on msn messenger for free | jrobbio | Computer Software Forum - Windows | 2 | 27-Jun-2004 20:26 |
| Great way to disable flash rightclick menu | BobbyDouglas | Web Design Forum | 0 | 02-Sep-2003 18:23 |
| top menu bar trouble | chalaska | Web Design Forum | 3 | 18-Jul-2002 21:11 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The