Differences

This shows you the differences between two versions of the page.

Link to this comparison view

web:contextmenu [2018/11/01 16:58]
agcyphers [Examples]
web:contextmenu [2019/10/23 05:53]
Line 1: Line 1:
-==== See Also ==== 
-[[web:​contextmenuitem|GraffitiWebContextMenuItem]] 
  
-==== Enumerations ==== 
-^ Name      ^ Values ​      ^ 
-|  | This class exposes no enumerations. | 
- 
-==== Constants ==== 
-^ Name      ^ Type     ^ Value       ^ 
-| TriggerHover | [[http://​developer.xojo.com/​integer|Integer]] | 3 | 
-| TriggerLeft | [[http://​developer.xojo.com/​integer|Integer]] | 2 | 
-| TriggerNone | [[http://​developer.xojo.com/​integer|Integer]] | 0 | 
-| TriggerRight | [[http://​developer.xojo.com/​integer|Integer]] | 1 | 
- 
-==== Events ==== 
-^ Definition ​     ^ Description ​      ^ 
-| MenuAction( menuID as [[http://​developer.xojo.com/​string|String]],​ itemID as [[http://​developer.xojo.com/​string|String]] ) | Fires when the user selects an item from a displayed menu. | 
-| MenuHidden( menuID as [[http://​developer.xojo.com/​string|String]] ) | Fired when the menu is hidden. | 
-| MenuShown( menuID as [[http://​developer.xojo.com/​string|String]] ) | Fires when a menu becomes visible. | 
- 
-==== Methods ==== 
-^ Definition ​     ^ Description ​      ^ 
-| AddMenu( MenuID as String, theMenu as GraffitiWebContextMenuItem ) | Adds an "​Unattached"​ context menu, which can displayed anywhere and from any control. | 
-| AddMenu( theControl as [[http://​developer.xojo.com/​webcontrol|WebControl]],​ MenuID as [[http://​developer.xojo.com/​string|String]],​ Trigger as [[http://​developer.xojo.com/​integer|Integer]],​ theMenu as GraffitiWebContextMenuItem ) | Binds a menu to a control. | 
-| HideMenu( MenuID as String ) | Hides the menu with the specified ID, if it is currently visible. | 
-| HideMenu( theControl as [[http://​developer.xojo.com/​webcontrol|WebControl]] ) | Hides the menu for theControl, if it is currently visible. | 
-| ShowMenu( MenuID as String, X as [[http://​developer.xojo.com/​integer|Integer]] = -1, Y as [[http://​developer.xojo.com/​integer|Integer]] = -1 ) | Shows the menu with the specified ID, at the specified coordinates. ​ If both are -1, will show at cursor. | 
-| ShowMenu( theControl as [[http://​developer.xojo.com/​webcontrol|WebControl]],​ X as [[http://​developer.xojo.com/​integer|Integer]] = -1, Y as [[http://​developer.xojo.com/​integer|Integer]] = -1 ) | Shows the menu for theControl, at the specified coordinates. ​ If both are -1, will show at cursor. | 
-| Unbind( theControl as [[http://​developer.xojo.com/​webcontrol|WebControl]] ) | Removes the menu from the specified WebControl | 
- 
-==== Properties ==== 
-^ Name      ^ Type       ^ Default Value       ^ Description ​      ^ 
-|  |  |  | This classes exposes no properties. | 
- 
-==== Examples ==== 
-=== Xojo WebListBox === 
- 
-To implement in the MouseUp event, you must provide the X and Y parameters for where the menu should appear. 
-<code xojo>if Details.Button = 2 then 
-  gwcmDemo.ShowMenu( me, me.left + X, me.top + Y ) 
-end if</​code>​ 
- 
-=== Styles === 
-GraffitiWebContextMenuItems have a Style property, to which you can assign a WebStyle. If this is the top-level item used in the AddMenu call, then that style is used to style the backdrop of the contextmenu and all sub-menus. If it is an item within the top-level or sub- menu, then it is used to style the individual item. 
- 
-=== Unbound Menus === 
-To create an unbound menu (one which is not attached to a control), you simply call the AddMenu overloaded method: 
-<code xojo>dim unattachedMenu as new GraffitiWebContextMenuItem( "​unattachedMenu"​ ) 
-unattachedMenu.Children.Append( new GraffitiWebContextMenuItem( "​unattached1",​ "Item 1" ) ) 
-unattachedMenu.Children.Append( new GraffitiWebContextMenuItem( "​unattached2",​ "Item 2" ) ) 
-gwcmDemo.AddMenu( "​unattachedMenu",​ unattachedMenu ) 
-</​code>​ 
- 
-And to show this menu: 
-<code xojo>​gwcmDemo.ShowMenu( "​unattachedMenu"​ )</​code>​