src/swipl-devel/packages/xpce/man/refmanual/md/popup.md

class popup {#class-popup}

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 <->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 ->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 ->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.

@see graphical->popup @see class popup_gesture @see class menu_item @see class menu @see class menu_bar @see topic Using menu's @see window-popup @see menu_item-popup @see list_browser-popup @see dialog_item-popup

Instance variables {#class-popup-instvars}

Send methods {#class-popup-send}



Try the rswipl package in your browser

Any scripts or data that you put into this service are public.

rswipl documentation built on June 16, 2026, 5:07 p.m.