Attaching popup menus to forms
Popup menus normally appear when a user right-clicks a form or control. Like dropdown menus, popup menu files (extension .POP) can be created using a special designer, also described later in this chapter.
However, popups are attached to forms in a different manner than pulldown menus.
To attach a popup menu, you must assign the popup object to your form’s PopupMenu property. Unlike pulldown menus, however, you can’t make the connection with the popup menu file name alone. To attach a popup, you need to add some code, either through a codeblock or within a form or control event handler.
The simplest and most common means of attaching a popup to a form is through a form’s onOpen event. If, for example, you create a popup menu file called MYPOPUP.POP, you can make the menu available to any form by typing a codeblock like this into the form Inspector’s onOpen event:
{;do mypopup.pop with this, "popup"; this.popupmenu = this.popup}
Alternatively, you can click the onOpen event’s tool button and apply the same code as a linked method:
// {Linked Method} Form.onOpen
function Form_onOpen
do mypopup.pop with this, "popup"
this.popupmenu = this.popup