GNU TeXmacsUser manualReferenceAboutEnglish
Widgets reference guide

This is a reference list of all the keywords which may be used inside menu-bind, tm-menu and tm-widget definitions. The authoritative list is the table gui-make-table in

progs/kernel/gui/menu-define.scm

: each keyword is translated by gui-make into one of the $-macros of

progs/kernel/gui/gui-markup.scm

, and the resulting menu items are turned into actual widgets by make-menu-widget in

progs/kernel/gui/menu-widget.scm

. How this works is explained in “The Scheme widget language and its interpreter”.

In what follows, items stands for any number of menu items (widgets), label for a menu label (see below) and cmd for arbitrary Scheme code which is executed when the widget is activated. For input widgets, the code cmd is wrapped into a function of one argument, so that the value entered by the user is available in cmd as the variable answer. Most other arguments (lists of values, default values, predicates) are re-evaluated each time the widget is built.

1.Buttons, labels and text

(label cmd …)
(a menu entry or button)

A list whose first element is a label (a string or one of the label constructs below) is a menu entry: when it is selected, the remaining elements are evaluated as a Scheme body. Inside a window, the entry is rendered as a flat (toolbar style) button, unless it is enclosed in explicit-buttons. When the command is a function with an :interactive property, dots are appended to the label; a :check-mark property yields a check-mark, a :balloon or :synopsis property yields a tooltip, and a keyboard shortcut for the command is displayed automatically.

(text s)
(a text label)

Displays the (translated) string s.

(group s)
(a menu group title)

A title for a group of entries inside a menu.

(icon file)
(an icon label)

Uses the pixmap file (for instance "tm_new.xpm", looked up in $TEXMACS_PIXMAP_PATH) as the label of an entry, as in ((icon "tm_new.xpm") (new-document)).

(concat s1 … sn)

(verbatim s1 … sn)

(replace s arg1 … argn)
(composite labels)

Labels made of several translatable strings, labels which should not be translated, and labels s containing placeholders %1, …, %n which are replaced by the (translated) arguments, as in ((replace "Open %1" (verbatim "my-init-texmacs.scm")) …).

(balloon label tooltip)
(a label with a tooltip)

Attaches the tooltip tooltip to the entry with label label, as in ((balloon (icon "tm_save.xpm") "Save this buffer") (save-buffer)).

(check label mark pred)
(a label with a check-mark)

Displays the check-mark mark (usually "v" or "*") in front of the entry whenever the predicate pred holds.

(shortcut label keys)
(a label with an explicit shortcut)

Displays the keyboard shortcut keys next to the entry, instead of the automatically found one.

(symbol sym)

(symbol sym cmd)
(a symbol button)

A button showing the TeXmacs symbol sym (like "<alpha>"). By default, pressing it inserts the symbol; otherwise cmd is executed.

(invisible x)
(an invisible item)

Produces no widget at all; used internally by push-focus.

2.Separators and glue

(glue hext? vext? w h)
(possibly extensible space)

Whitespace of minimal size w\(\times\)h (in pixels), which may extend horizontally and/or vertically. See “Containers, glue, refresh and co.”.

(color col hext? vext? w h)
(colored glue)

Like glue, but filled with the color (or pattern) col. Colored glue is typically used as the label of color selection buttons.

--- | / === ====== // /// >> >>>
(separators and glue abbreviations)

--- is a horizontal separator line (between the items of a vertical menu), | and / are vertical separators. The other symbols are abbreviations for glue: === and ====== for vertical space of 5 resp. 15 pixels, // and /// for horizontal space of 5 resp. 15 pixels, >> and >>> for horizontally extensible space.

3.Input widgets

(input cmd type proposals width)
(a text input field)

A one line text field. type is a string such as "string", "password", "file", "directory", "search" or "replace-what", proposals a list of strings whose first element is the initial value, and width a length such as "20em" or "1w". The widths of the widgets are given in four units only: px, em (14 pixels), and w or h, a multiple of the default width or height of the widget in Qt and Cocoa, but of the extents of the window in Vue and Widkit (a field of "2w" is then wider than its window: prefer em in dialogs). cmd is executed with answer set to the entered string when the user confirms the input (or to #f when the input is cancelled).

(toggle cmd on?)
(a check box)

A check box with initial state on?; cmd is executed with answer set to the new state.

(enum cmd vals val width)
(a combo box)

A combo box with the list of strings vals and the current value val. If the last element of vals is "", then the user may also type an arbitrary value. See “Displaying lists and trees”.

(choice cmd vals val)

(choices cmd vals selected)
(list boxes)

A list of items allowing for the selection of one resp. several items. For choices, selected and answer are lists.

(filtered-choice cmd vals val filter)
(a list box with a filter)

Like choice, but with a text field on top which filters the displayed items; answer holds the selected item and filter the current contents of the filter field.

(tree-view cmd data roles)
(a tree view (not in the X11/Widkit port))

Displays the TeXmacs tree data; see “Displaying lists and trees”. Contrary to the other input widgets, cmd must be a procedure.

(color-input cmd background? proposals)
(a color picker)

A color picker, which also allows for the selection of patterns if background? holds.

(pick-color cmd)

(pick-background scale cmd)
(palettes of colors and patterns)

Tiles of buttons for standard colors, resp. colors and background patterns; cmd is executed with answer set to the selected color or pattern. In Vue, the color menu also offers a Palette enumeration: typographic palettes, defined with define-typographic-palette or define-typographic-palette-from-colors, replace the standard colors (preference typographic palette set).

(texmacs-output doc style)

(texmacs-input doc style name)
(embedded TeXmacs documents)

A read-only resp. editable TeXmacs document doc (a tree or Scheme tree), typeset with the given style, such as '(style "generic"). For texmacs-input, name is the URL of the auxiliary buffer which holds the document (or #f).

(ink cmd)
(a handwriting area)

An area for drawing with the mouse or a pen; answer contains the recorded strokes.

(setting-toggle cmd description on?)

(setting-enum cmd description vals val width)

(setting-group title items)
(preference panel controls)

Variants of toggle and enum which display an additional description text, and a titled group of such controls, intended for preference panels.

4.Menus

(-> label items)

(=> label items)
(submenus)

A button which opens the submenu made of items to the right (pullright) resp. below (pulldown). The submenu is only built when it is opened.

(horizontal items)

(vertical items)
(menu bars and menus)

Horizontal resp. vertical menus, such as menu bars and toolbars resp. ordinary menus.

(tile columns items)
(a tiled menu)

Arranges items in a table with columns columns, as in the palettes for mathematical symbols; columns must be an integer written in the menu (not an expression).

(minibar items)

(mini pred items)
(minibars)

Small toolbars inside menus resp. items which are rendered in a smaller size when pred holds. Both only have an effect when the preference "use minibars" is on; otherwise the items are displayed normally.

(link menu)
(include another menu)

Includes the menu defined by (menu-bind menu …); the menu is looked up each time the widget is built.

5.Layout

(hlist items)

(vlist items)
(horizontal and vertical lists)

Arrange items horizontally resp. vertically.

(aligned (item left right) …)

(meti right left)
(two column layout)

A two column table, typically with labels on the left and input widgets on the right. meti is item with the two arguments in the reverse order (so that a toggle can be written before its label).

(tabs (tab label items) …)

(icon-tabs (icon-tab icon label items) …)
(tabbed widgets)

A tab widget with one page for each tab resp. icon-tab. The variants responsive-tabs / responsive-tab and responsive-icon-tabs / responsive-icon-tab have the same syntax but adapt their layout to the available space.

(section-tabs name key (section-tab title items) …)
(light-weight tabs)

Tabs made of ordinary buttons, implemented in the widget language itself using refreshable; the index of the active tab is stored under the given name and key (see section-tab-ref).

(hsplit left right)

(vsplit top bottom)
(split panes)

Two widgets separated by a movable border.

(scrollable items)
(scroll bars)

Puts items (vertically) inside a scroll area.

(resize w h items)
(set the size)

Sets the size of items. Each of w and h is evaluated and is either a length string, like "200px", or a list of three strings (minimal, default and maximal size), optionally followed by the initial position of the scrolled contents ("left", "center" or "right", resp. "top", "center" or "bottom"; only honoured by Vue). Lists must be quoted, as in (resize '("100px" "200px" "400px") "50px" …).

(padded items)

(centered items)

(bottom-buttons items)
(layout helpers)

Surround items by fixed glue, center them, resp. put them as explicit buttons in a horizontal bar below a separator. These are expanded into combinations of vlist, hlist and glue.

(division name items)

(class name items)
(style sheet classes)

Vertical resp. horizontal groups of items to which the style sheet class name (like "title", "plain") is applied; used for the side tools and dialogs when a style sheet is active.

(extend widget items)
(enlarge a widget)

Extends the size of widget to the maximum of the sizes of the items (the items themselves are not displayed). This is ignored by the Qt and Cocoa ports.

6.Styles

(explicit-buttons items) (inert items) (bold items) (grey items) (mono items) (verb items) (plain-style items)
(style attributes)

Render the entries of items as explicit buttons, as inactive (greyed out) widgets, in bold face, in grey, in a monospaced font, without translation of the labels; plain-style keeps the style as it is (it is meant to reset it, but its implementation, a style of 0 in make-menu-style, changes nothing).

7.Control structures

(if pred items)

(when pred items)

(assuming pred items)
(conditional items)

if only shows items when pred holds, and when greys them out when it does not; in both cases, pred is re-evaluated each time the widget is built. assuming includes or omits the items once and for all when the menu is computed. Notice that there is no else branch.

(cond (pred items) …)

(let bindings items) (let* bindings items)

(with var val items) (receive vars val items)
(Scheme control structures)

The usual Scheme (and TeXmacs) constructs, whose bodies are lists of widgets.

(for (x l) items)

(loop (x l) items)
(loops)

Repeat items for each element x of the list l. For for, the list is re-evaluated each time the widget is built; for loop, only when the menu is computed.

(dynamic expr)
(include a computed menu)

Evaluates expr, which usually is a call of a function defined with tm-menu or tm-widget, and includes the resulting items. This is the standard way to reuse a widget with arguments inside another one, as in (dynamic (my-widget cmd)).

(eval expr)
(computed label)

Evaluates expr, which should return a label or a menu item. For instance, (-> (eval (car p)) …) uses a computed label for a submenu.

(promise expr)
(delayed items)

Evaluates expr each time the widget is built; the result must be a menu item.

(former)
(previous definition)

Inside a redefinition of a menu with menu-bind or tm-menu, includes the items of the previous definition. See contextual overloading.

(push-focus t items)
(focus dependent items)

Builds items with the variables pushed-tree and pushed-focus bound to t and its fingerprint; used by the focus menus and toolbars.

8.Refreshing

(refreshable kind items)

(refresh widget kind)

(refresh widget)

(cached kind valid? items)
(widgets which can be rebuilt)

A refreshable group of items is rebuilt each time (refresh-now kind) is called, where kind is (an expression evaluating to) a string. refresh includes the menu or widget widget (the name of a menu-bind or of a tm-widget without arguments, not evaluated) in the same way; here kind is written as a symbol, as in (refresh my-widget auto); without kind, the kind is the name of the widget. Widgets of kind "auto" are also refreshed automatically after each user command, and widgets of kind "any" by any call of refresh-now. A cached group is rebuilt at a refresh-now of its kind only if valid? does not hold or after (invalidate-now kind). A refresh makes the widgets again from the items computed when the enclosing widget was built: texts, labels and dynamic keep their value, while conditions, for lists and promises are evaluated again. See “Containers, glue, refresh and co.”.

9.Forms

(form name items)

(form-input field type proposals width)

(form-enum field vals val width)

(form-choice field vals val)

(form-choices field vals selected)

(form-toggle field on?)
(forms)

Named input fields whose values are stored under the name of the enclosing form; see “Forms”.

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation; with no Invariant Sections, with no Front-Cover Texts, and with no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License".