New topic: Contextual Menu on PopUP Menus
<http://forums.realsoftware.com/viewtopic.php?t=33787> Page 1 of 1 [ 13 posts ] Previous topic | Next topic Author Message NA9D Post subject: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 2:59 pm Joined: Mon Feb 01, 2010 3:36 pm Posts: 77 Is it possible to display a contextual menu for a pop-up menu? I'm not able to make it work - at least in OS X. Every time I right click on the pop-up menu, it brings up the list of menu items. The documentation doesn't say anything about contextual menus not working for pop-up menus. I've tried the normal "construct contextual menu" even and also tried creating a new menu item in the mouse down event of the control and use the menuitem.popup method. Nothing seems to work? Is this not possible? I don't want a contextual menu item for the list of items in the control but just for the control itself. Thanks, Jon Top rbasic20091005153 Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 3:28 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 865 I've tested it. It works. If it's not working, then I'm afraid you are not doing it right. _________________ Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4 -------------------------------------------------- Don't plugin-spam me. Watch out for European spammers who try to sell plug-ins you don't even need. Top NA9D Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 3:38 pm Joined: Mon Feb 01, 2010 3:36 pm Posts: 77 OK. Then help me out... In the ConstructContextualMenu function inside my popup control I have: Code: base.Append(New MenuItem("Reset Source")) Return True And in the ContextualMenuAction function I have all my code and hititem statements. This EXACT same code works on some text fields but NOT on the pop-up menu controls. So what's wrong? Top rbasic20091005153 Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 3:48 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 865 Why do you want to use ConstructContextualMenu? Do you need to combine multiple menus into one? _________________ Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4 -------------------------------------------------- Don't plugin-spam me. Watch out for European spammers who try to sell plug-ins you don't even need. Top NA9D Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 3:54 pm Joined: Mon Feb 01, 2010 3:36 pm Posts: 77 rbasic20091005153 wrote:Why do you want to use ConstructContextualMenu? Do you need to combine multiple menus into one? I don't understand. It's there as one of the event handlers for my control. It's how the manual says to do it. How else do you do it? Top serd83 Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 3:57 pm Joined: Thu Feb 22, 2007 7:08 pm Posts: 1074 I assume your code looks like this? Code:Function ContextualMenuAction(hitItem as MenuItem) As Boolean if hitItem.text = "Reset Source" then msgbox"OK" End Function Top rbasic20091005153 Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:09 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 865 If you don't have to construct a menu by combining multiple commands into one but just want to use an existing menu like FileMenu and EditMenu, then you can do it as simply as by place a code like the one below under MouseDown. Code:If Me.Enabled=True Then If IsContextualClick Then Dim m As MenuItem m=EditMenu.Popup End if End if If you use ConstructContextualMenu, you have to revise the list every time you want to add a new command. So I don't use it very often. I would rather create a new menu. _________________ Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4 -------------------------------------------------- Don't plugin-spam me. Watch out for European spammers who try to sell plug-ins you don't even need. Top NA9D Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:11 pm Joined: Mon Feb 01, 2010 3:36 pm Posts: 77 rbasic20091005153 wrote:If you don't have to construct a menu by combining multiple commands into one but just want to use an existing menu like FileMenu and EditMenu, then you can do it as simply as by place a code like the one below under MouseDown. Code:If Me.Enabled=True Then If IsContextualClick Then Dim m As MenuItem m=EditMenu.Popup End if End if If you use ConstructContextualMenu, you have to revise the list every time you want to add a new command. So I don't use it very often. I would rather create a new menu. No, what I want to have is a specific action to perform as a result of a contextual menu selection. It's not using an existing menu from the menu bar. And I tried doing code just like you have here in the mouse down event and it wouldn't work... Top rbasic20091005153 Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:28 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 865 Sorry... EditMenu is a bad example. You can't use it with PopupMenu. If it's not working, then you may have to work on EnableMenuItems. _________________ Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4 -------------------------------------------------- Don't plugin-spam me. Watch out for European spammers who try to sell plug-ins you don't even need. Top NA9D Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:42 pm Joined: Mon Feb 01, 2010 3:36 pm Posts: 77 rbasic20091005153 wrote:Sorry... EditMenu is a bad example. You can't use it with PopupMenu. If it's not working, then you may have to work on EnableMenuItems. OK. But it still takes me back to my original question: Why does the ConstructContextualMenuItem function not work on PopUp Menus? According to what I see in the documentation it should work for any RECT control class. But it's not... Top timhare Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:42 pm Joined: Fri Jan 06, 2006 3:21 pm Posts: 7751 Location: Portland, OR USA rbasic20091005153 wrote:Sorry... EditMenu is a bad example. You can't use it with PopupMenu. If it's not working, then you may have to work on EnableMenuItems. What would EnableMenuItems possibly have to do with a contextual menu? Jon, your code should be working. It works for me on Windows on a prior version of RB. So the question becomes, is anyone else experiencing the same issue under OSX? To assist people who want to answer that, please give us the version of RB and of OSX you are using. Top rbasic20091005153 Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:57 pm Joined: Sat Apr 04, 2009 5:10 pm Posts: 865 Quote:What would EnableMenuItems possibly have to do with a contextual menu? Since he said Quote:And I tried doing code just like you have here in the mouse down event and it wouldn't work... I thought something was disabled under EnableMenuItems. Sorry for my advice... _________________ Mac OS X 10.5.8/REALBasic 2008 R5.1 ~ REALBasic 2009 R4 -------------------------------------------------- Don't plugin-spam me. Watch out for European spammers who try to sell plug-ins you don't even need. Last edited by rbasic20091005153 on Fri May 14, 2010 5:10 pm, edited 1 time in total. Top NA9D Post subject: Re: Contextual Menu on PopUP MenusPosted: Fri May 14, 2010 4:57 pm Joined: Mon Feb 01, 2010 3:36 pm Posts: 77 timhare wrote:rbasic20091005153 wrote:Sorry... EditMenu is a bad example. You can't use it with PopupMenu. If it's not working, then you may have to work on EnableMenuItems. What would EnableMenuItems possibly have to do with a contextual menu? Jon, your code should be working. It works for me on Windows on a prior version of RB. So the question becomes, is anyone else experiencing the same issue under OSX? To assist people who want to answer that, please give us the version of RB and of OSX you are using. I'm running OS X 10.6.3 and RB 2010 R2. I'm wondering if it might not be something more along the lines of the fact that in OS X, a PopUP menu won't accept focus while it can on Windows. So I can't tab between pop-up menu items either. I will try running my code on a Windows machine and see what happens... Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 13 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
