New topic: Contextual menu won't fire
<http://forums.realsoftware.com/viewtopic.php?t=45704> Page 1 of 1 [ 3 posts ] Previous topic | Next topic Author Message grechcj Post subject: Contextual menu won't firePosted: Wed Oct 24, 2012 2:32 pm Joined: Sun Feb 14, 2010 11:19 pm Posts: 187 Location: Australia I have a label with code in the mouseDown event as well as code to display a contextual menu. When I right-click (Windows) the label the mouseDown event fires and runs (which I don't want) but the contextualMenuAction doesn't. ConstructContextualMenu base.append(New MenuItem("Delete")) base.append(New MenuItem("Rename")) ContextualMenuAction Select Case HitItem.text case "Delete" DeleteDatabase(linkPath) case "Rename" RenameDatabase(linkPath) End select MouseDown OpenFile(me.caption) Top charonn0 Post subject: Re: Contextual menu won't firePosted: Wed Oct 24, 2012 3:19 pm Joined: Mon Apr 02, 2007 2:08 am Posts: 937 Location: San Francisco, CA, USA The MouseDown event fires before the ContextualMenu* events do, and doesn't differentiate between left- and right-clicks. Additionally, other mouse-click-related events (the Context menu events, MouseUp, MouseDrag, etc.) don't fire at all unless you Return True from the MouseDown event. You can test whether a click is a context-click by querying IsContextualClick, and return True or False depending on the kind of click: Function MouseDown(X As Integer, Y As Integer) As Boolean If IsContextualClick Then Return True 'Trigger the other events Else OpenFile(me.caption) Return False 'Don't trigger the other events, which is the default behavior End If End Function _________________ Boredom Software Top grechcj Post subject: Re: Contextual menu won't firePosted: Wed Oct 24, 2012 3:44 pm Joined: Sun Feb 14, 2010 11:19 pm Posts: 187 Location: Australia Thanks charonn0, that works perfectly. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 3 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]
