context
popup menus<element id="input-field"> <input_field /> <config> <!-- ... --> </config> <context id="popup"> <menu> <append_items> <items> <label type='theme_text'>Reset</label> </items> </append_items> <append_copy_cut_paste> <parent>input-field</parent> </append_copy_cut_paste> </menu> <shortcut type='theme_text'>Alt-I</shortcut> </context> </element>
All supported theme widgets have an optional
context
element that uses
create_popup_menu
() to create a
context popup menu.
Its
menu
element
generates the list layout
manager for the context popup menu. An
optional shortcut
contains a
keyboard x::w::shortcut
value.
&ns;::w::container popup=elements.get_element("popup");
context
's optional
id
attribute gives
the popup menu container's identifier, making it possible
to
retrieve the container
from
x::w::uielements
.
An append_copy_cut_paste
in the popup menu
adds standard
“Copy”,
“Cut”, and
“Paste” menu items. Its
parent
should be its element's
id
.
The context popup automatically takes care of
update
()ing these menu items before the
popup gets shown. It is not necessary to add the code for that, like
for
“Copy”,
“Cut”, and
“Paste” in the main application menu.
<container> <type>grid</type> <name>main_grid</name> <context> <menu> <append_items> <items> ... </items> </append_items> </menu> </context> </container>
container
elements also
have optional context
popup menus.