Push Button - Menu Property

Reference to a menu to be attached to the button

Member of Push Button (PRIM_PHBN)

Data Type - PRIM_PMNU - Popup Menu

Details

The Menu property is a reference to a PRIM_PMNU to be attached to the button.
 
Once a menu is attached the Click event will no longer fire.
 
Use of the Enter key will cause the Default menu item to fire its click event.
 
The MenuPromptPosition property is used to position the menu arrow.

Example

This example shows two buttons configured to use the same popup menu.
 
The MenuPosition and MenuSeparator properties have been used on the second button to change the where the menu appears and how the button manages a click and Enter.
Function Options(*DIRECT)
Begin_Com Role(*EXTENDS #PRIM_FORM) Clientwidth(660) Clientheight(338) Componentversion(2) Top(215) Left(237)
 
   Define_Com Class(#PRIM_PHBN) Name(#Button1) Caption('Button1') Displayposition(1) Left(7) Parent(#COM_OWNER) Tabposition(1) Top(6) Menu(#PopupMenu1) Width(90)
   Define_Com Class(#PRIM_PHBN) Name(#Button2) Caption('Button2') Displayposition(2) Left(111) Parent(#COM_OWNER) Tabposition(2) Top(7) Width(138) Menu(#PopupMenu1) Menuposition(Right) Menuseparator(True)
   Define_Com Class(#PRIM_PMNU) Name(#PopupMenu1)
   Define_Com Class(#PRIM_MITM) Name(#MenuItem1) Caption('Item1') Displayposition(1) Parent(#PopupMenu1)
   Define_Com Class(#PRIM_MITM) Name(#MenuItem2) Displayposition(2) Parent(#PopupMenu1) Caption('Item2') Default(True)
   Define_Com Class(#PRIM_MITM) Name(#MenuItem3) Displayposition(3) Parent(#PopupMenu1) Caption('Item3')
 
   Evtroutine Handling(#MenuItem1.Click #MenuItem2.Click #MenuItem3.Click) Com_Sender(#Sender)
 
      #Com_owner.Caption := #Sender.Caption
 
   Endroutine
 
End_Com

See also

All Component Classes

Technical Reference

Febuary 18 V14SP2