A popup is a menu that is associated with a graphical
object, but is normally invisible. When the user depresses a predefined
button, the popup is poped-up’. After the user has
made a choice, the popup is removed from the display again.
Some types of graphicals have an attribute called dialog_item<->popup.
For these types the easiest way to attach a popup to them is to fill
this attribute with a popup menu. General graphicals don't have this
feature. For these graphicals a popup_gesture
object has to be used to connect the popup with some event. See also graphical->popup
and
graphical->event.
PCE encourages you to associate popup-menus with the right mouse-button only.
By default, a popup menu inverts the current item. This gives odd results on colour displays. You can change this into a box by adding the following line to your Defaults file.
popup.preview_feedback: box
The method popup->execute
is activated to execute the behaviour associated with the selected item.
The documentation of this method describes the available context
parameters.
Forwarding rules for associated messages are described with
popup->execute.
User interface:
When (normally) the right button is depressed on an object that has a popup associated to it, the popup will be mapped on the display such that the first option is below the mouse. If possible, the mouse itself is not moved.
The user should HOLD the mouse-button depressed and DRAG to the approprate choice to RELEASE the mouse-button there. This will invoke the associated command.
The user can CANCEL the operation by dragging the mouse-button outside the popup and releasing it.
If an item has a mark _=>_ at the right side, SUB-MENU can be obtained by dragging towards this mark.
Bugs:
Interface styles such as stay-up, OpenWindow like
push-pins, etc. are not supported.
|any*
<-active.
first,
but places the pointer a few pixels to the left of the item so that it
is not immediately selected.
<-selection
of the popup. In practice this is the last selected item.
<-value.
See also
<-border.->update.
This message is meant to generate the entries of the popup. Activating
individual items is normally done by the condition message associated
with each menu_item of the popup.
When executed, the following arguments are forwarded:
@receiver The popup itself @arg1 The argument of popup ->update
Defaults: By default, no updating takes place
->close
possible open pullright menus. Then is removes the popup menu from its graphical<-window
and adds the window to the pool of window
objects used to display popup menu's.
This method is always called as a normal message and thus may be redefined.
->event.
It should not be used, nor be redefined, except for emergencies.
This method locates the current item using menu<-item_from_event
and activates this using menu->preview.
If the drag event is on an item with a menu_item<-popup
and the event is near the popup marker (see menu<-popup_image),
the pullright menu is activated by invoking popup->show_pullright_menu.
->end_group
in the associated menu_item. This will put a line below the item.
->close
the pullright menu.
<-selected_item with the pullright
menu, assign -pullright with
@nil and popup->close
the pullright.
<-selected_item with menu<-preview
and popup->close
the popup.
<-selected_item
to @nil and
send popup<-button to the event<-button
->preview.
If a pullright area is entered, popup->update
the pullright and popup->open
it.
->terminate.
The argument (denoted context) is normally the object to
which the popup menu is associated.
First it locates the selected menu_item
object and the message to execute. This message is menu_item<-message
if this does not yeild @default,
otherwise dialog_item<-message.
The forwarded arguments are:
<-multiple_selection: @off
using menu_item<-message
@receiver: The popup @arg1: The context argument
<-multiple_selection: @off
using dialog_item<-message
@receiver: The popup @arg1 menu_item <-value@arg2: The context argument
<-multiple_selection: @on
using menu_item<-message
@receiver: The popup @arg1: menu_item <-selected@arg2: The context argument
<-multiple_selection: @on
using dialog_item<-message
@receiver: The popup @arg1: menu_item <-value@arg2: menu_item <-selected@arg3: The context argument
<-show_label
equals @on)
and a message. This message will be executed when a menu_item
object is selected that has‘menu_item dialog_item<-message:
@default’.
Using a message at the popup (menu) level is commonly used if the menu
selects from a value-set (fonts, colours, names. ...). If the menu is
used to activate commands the actions are normally associated with the
individual items.
<-context)
<-context iff offset_is_pointer
equals @off,
otherwise the position of the pointer.
->close.->drag. item
is the item for which to show a pullright menu. First updates the menu_item<-popup
and -if the popup has menu<-members-
opens the popup..e.
all normal ways to manage a popup).
Update first invokes popup<->update_message,
providing its argument as @arg1.
This message is supposed to update the available entries of the popup;
not the activation status of the individual entries. Next, popup->update
invokes menu->update,
which takes care of activating the appropriate entries.