Widgets for creating applications
Whether the widget can receive the focus or not.
Enqueue a redraw operation. If the widget has a parent, this is the same as calling the queue_draw method of the parent, otherwise this does nothing.
set_queue_draw f sets the function called when the
queue_draw method is invoked, for this widget and all its
The resource class of the widget.
Sets the resource class of the widget. This can be used to set an alternative style for the widget.
Method invoked when the resources or the resource class of the widget change. The default function does nothing.
The base class. The parameter is the initial resource class. The resource class is the first part of all resource keys used by the widget.
For examples, buttons use the resources
"button.unfocused.bold", ... so
their resource class is
add ?position ?expand widget adds a widget to the box. If
true (the default) then
widget will occupy as
much space as possible. If
position is not specified then
the widget is appended to the end of the widget list. It
raises Out_of_range if the given position is negative or
exceed the number of widgets.
Type of widgets displaying a list of widget.
The state of the group. Contains
Some id with the id of "on" object
in the group or None if no objects were added to the group yet.
Radio group governs the set of radio objects. At each given moment of time only one of the objects in the "on" state and the rest are in the "off" state.
run term ?save_state widget w runs on the given terminal using
widget as main widget. It returns when
w terminates. If
true (the default) then the state of the
terminal is saved and restored when
true (the default) then
resources_file (which default to ".lambda-termrc" in the home
directory) is loaded and the result is set to
This function works in the same way as run but also takes two Lwt_react.event parameters. The first one should contain LTerm_widget.t widget and makes it new topmost layer in UI. The second message removes the topmost level from UI. All layers are redrawn, from bottom to up, but only the topmost layer gets keyboard events delivered to it. This allows to implement things like modal dialogs.
prepare_simple_run () returns a tuple
(do_run, push_layer, pop_layer,
exit) -- functions useful for creating simple UI.
do_run w where w is a widget runs the given widget in a terminal over
stdout, loading resources from
.lambda-termrc, saving state and
restoring it on exit from ui.
push_layer w where w is a widget is a callback to add w as a new modal
layer to UI.
button#on_click (push_layer my_modal_dialog).
pop_layer is a callback to destroy the topmost modal layer.
exit is a callback to exit the UI.