See Also


Name Values
This class exposes no enumerations.


Name Type Value
TriggerHover Integer 3
TriggerLeft Integer 2
TriggerNone Integer 0
TriggerRight Integer 1


Definition Description
MenuAction( menuID as String, itemID as String ) Fires when the user selects an item from a displayed menu.
MenuHidden( menuID as String ) Fired when the menu is hidden.
MenuShown( menuID as String ) Fires when a menu becomes visible.


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 WebControl, MenuID as String, Trigger as 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 WebControl ) Hides the menu for theControl, if it is currently visible.
ShowMenu( MenuID as String, X as Integer = -1, Y as Integer = -1 ) Shows the menu with the specified ID, at the specified coordinates. If both are -1, will show at cursor.
ShowMenu( theControl as WebControl, X as Integer = -1, Y as Integer = -1 ) Shows the menu for theControl, at the specified coordinates. If both are -1, will show at cursor.
Unbind( theControl as WebControl ) Removes the menu from the specified WebControl


Name Type Default Value Description
This classes exposes no properties.


Xojo WebListBox

To implement in the MouseUp event, you must provide the X and Y parameters for where the menu should appear.

if Details.Button = 2 then
  gwcmDemo.ShowMenu( me, me.left + X, + Y )
end if


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:

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 )

And to show this menu:

gwcmDemo.ShowMenu( "unattachedMenu" )

This method is recommended for instances where you wish to have multiple menus tied to a single control.