A ContextMenu object is a menu that shows when the user clicks with the right button on
a control (desktop) or when a user taps and holds the pen over a control (device).
The menu is added to a specific control using a FormLib object.
One menu can be used by more than one control.
The context menu exposes one event, the Click event.
Using SelectedText or SelectedIndex properties you can find out which menu item was
clicked.
Note that on the desktop a context menu will appear on the chosen control and all its
child controls.
For example, if you add a context menu to a form it will show when you right click on
any control on the form.
On the device it will show only when you tap and hold on the form itself.
Example:
'Add a FormLib object named FormLib1 and a ContextMenu object named
Context1.
Sub Globals
End Sub
Sub App_Start
Form1.Show
FormLib1.New1("Form1",b4pobject(1))
Context1.New1
Context1.AddItem("Yes")
Context1.AddItem("No")
Context1.AddItem("-") 'Adds a separator
Context1.AddItem("Maybe")
FormLib1.AddContextMenu("TextBox1",Context1.Value)
End Sub
Sub Context1_Click
Select Context1.SelectedText
Case
"Yes"
'Do something
Case
"No"
'Do something
Case
"Maybe"
'Do something
End Select
End Sub