Difference between revisions of "RibbonButton.Menu"

From Jeremie Leroy - XOJO Controls Wiki
Jump to: navigation, search
m (4 revisions imported)
 
(2 intermediate revisions by the same user not shown)
Line 11: Line 11:
  
 
The [[RibbonButton.Menu|Menu]] to display if [[RibbonButton.HasMenu|HasMenu]] is True.
 
The [[RibbonButton.Menu|Menu]] to display if [[RibbonButton.HasMenu|HasMenu]] is True.
 +
 +
Menu is an instance of MenuItem.
 +
 +
The following code will add a Menu to a button
 +
<source lang="vb">
 +
  Dim bt As RibbonButton
 +
  bt = Ribbon.GetButton("Save")
 +
  bt.HasMenu = True
 +
 
 +
  Dim base As New MenuItem
 +
  base.Append New MenuItem("First action")
 +
  base.Append New MenuItem("Second action")
 +
  base.Append New MenuItem(MenuItem.TextSeparator)
 +
  base.Append New MenuItem("Third action")
 +
 
 +
  bt.Menu = base</source>
 +
 +
 +
The clicked item from the menu is handled in the [[RibbonCanvas.MenuAction]] event

Latest revision as of 17:04, 2 August 2016

Property (As MenuItem)
aRibbonButton.Menu = newValue
or
MenuItemValue = aRibbonButton.Menu


The Menu to display if HasMenu is True.

Menu is an instance of MenuItem.

The following code will add a Menu to a button

  Dim bt As RibbonButton
  bt = Ribbon.GetButton("Save")
  bt.HasMenu = True
 
  Dim base As New MenuItem
  base.Append New MenuItem("First action")
  base.Append New MenuItem("Second action")
  base.Append New MenuItem(MenuItem.TextSeparator)
  base.Append New MenuItem("Third action")
 
  bt.Menu = base


The clicked item from the menu is handled in the RibbonCanvas.MenuAction event