-
Notifications
You must be signed in to change notification settings - Fork 0
Reference Common Properties
Here we'll look at the properties that are available on every available widget and layout. These properties, along with the specific properties mentioned in the specific widget pages, form a complete reference of properties.
The horizontal position of the widget going left to right (so 0 is the left edge of a layout). Only works if the layout the object is placed in has the layout_mode property set to float. Unless you are explicitly doing manual positioning, you usually do not set this property.
Property type:
usize
Possible values:
Any usize value that falls within the width of the parent layout.
Default value:
0
Usage examples:
In EzLang files:
- Layout:
mode: float
- Label:
x: 5In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_x(5);
run(root_widget, state_tree, scheduler);The vertical position of the widget going top to bottom (so 0 is the top edge of a layout). Only works if the layout the object is placed in has the layout_mode property set to float. Unless you are explicitly doing manual positioning, you usually do not set this property.
Property type:
usize
Possible values:
Any usize value that falls within the height of the parent layout.
Default value:
0
Usage examples:
In EzLang files:
- Layout:
mode: float
- Label:
y: 5In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_y(5);
run(root_widget, state_tree, scheduler);This is an EzLang convenience that allows you to set 'x' and 'y' at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
mode: float
- Label:
pos: 5, 3The absolute width of the widget. Only works if the 'size_hint_x' property is set to None (because relative sizing is the default). Unless you are explicitly doing manual sizing, you usually do not set this property.
Property type:
usize
Possible values:
Any usize value that fits within the width of the parent.
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Label:
width: 20
size_hint_x: noneIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_width(20);
state.set_size_hint_x(None);
run(root_widget, state_tree, scheduler);The absolute height of the widget. Only works if the 'size_hint_y' property is set to None (because relative sizing is the default). Unless you are explicitly doing manual sizing, you usually do not set this property.
Property type:
usize
Possible values:
Any usize value that fits within the height of the parent.
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Label:
height: 20
size_hint_y: noneIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_height(20);
state.set_size_hint_y(None);
run(root_widget, state_tree, scheduler);This is an EzLang convenience that allows you to set 'width' and 'height' at the same time ( in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
size: 20, 10
size_hint: none, noneHorizontal size hint, which can be none, or a value between 0 and 1. If a value is set, the width of the widget will be set relative to the width of the parent; so 0.5 makes the widget half as wide as the parent, 1.0 equal width to the parent, etc. If set to none, some other method of sizing should be set; such as absolute size (width property) or scaling (auto_scale_width property).
This is the default method of sizing, meaning this is set to 1.0 by default, making the widget as large as the parent. If there are multiple widgets in a layout, all with size_hint_x 1.0, their size hint will change to 1 divided by number of widgets (i.e. all widgets will be equal size).
Property type:
SizeHint (Option)
Possible values:
- f64 between 0.0 and 1.0
- None
Default value:
1.0
Usage examples:
In EzLang files:
- Layout:
- Label:
size_hint_x: 0.5In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_size_hint_x(Some(0.5));
run(root_widget, state_tree, scheduler);Vertical size hint, which can be none, or a value between 0 and 1. If a value is set, the height of the widget will be set relative to the height of the parent; so 0.5 makes the widget half as high as the parent, 1.0 equal height to the parent, etc. If set to none, some other method of sizing should be set; such as absolute size (height property) or scaling (auto_scale_height property).
This is the default method of sizing, meaning this is set to 1.0 by default, making the widget as large as the parent. If there are multiple widgets in a layout, all with size_hint_y 1.0, their size hint will change to 1 divided by number of widgets (i.e. all widgets will be equal size).
Property type:
SizeHint (Option)
Possible values:
- f64 between 0.0 and 1.0
- None
Default value:
1.0
Usage examples:
In EzLang files:
- Layout:
- Label:
size_hint_y: 0.5In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_size_hint_y(Some(0.5));
run(root_widget, state_tree, scheduler);This is an EzLang convenience that allows you to set 'size_hint_x' and 'size_hint_y' at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
size_hint: 0.5, noneHorizontal position hint; works only when the parent layout is set to float mode. Positions widget horizontally relative to the parent, according to keywords (left/center/right). Also takes an optional value between 0 and 1, which allows you to adjust the keyword position; e.g. 'right: 0.9' is 90% of the way towards the right edge of the parent layout. You cannot use the optional value with the 'left' keyword, as it represents position 0. By default the adjustment value is set to 1.0, so just the keyword is used.
Property type:
HorizontalPositionHint (Option<(HorizontalAlignment, f64>)
Possible values:
Possible keyword values: - left - center - right Optional adjustment value: - f64 between 0.0 and 1.0
Default value:
None
Usage examples:
In EzLang files:
- Layout:
mode: float
- Label:
pos_hint_x: right: 0.75- Layout:
mode: float
- Label:
pos_hint_x: right- Layout:
mode: float
- Label:
pos_hint_x: noneIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_pos_hint_x(Some((HorizontalAlignment::Right, 0.75)));
run(root_widget, state_tree, scheduler);Vertical position hint; works only when the parent layout is set to float mode. Positions widget vertically relative to the parent, according to keywords (top/middle/bottom). Also takes an optional value between 0 and 1, which allows you to adjust the keyword position; e.g. 'bottom: 0.9' is 90% of the way towards the bottom edge of the parent layout. You cannot use the optional value with the 'top' keyword, as it represents position 0. By default the adjustment value is set to 1.0, so just the keyword is used.
Property type:
VerticalPositionHint (Option<(VerticalAlignment, f64>)
Possible values:
Possible keyword values: - top - middle - bottom Optional adjustment value: - f64 between 0.0 and 1.0
Default value:
None
Usage examples:
In EzLang files:
- Layout:
mode: float
- Label:
pos_hint_y: bottom: 0.75- Layout:
mode: float
- Label:
pos_hint_y: bottom- Layout:
mode: float
- Label:
pos_hint_y: noneIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_pos_hint_y(Some((VerticalAlignment::Bottom, 0.75)));
run(root_widget, state_tree, scheduler);This is an EzLang convenience that allows you to set 'pos_hint_x' and 'pos_hint_y' at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
pos_hint: right: 0.75, bottom: 0.75This property automatically scales the width of the widget to its content. This property has priority over the size_hint_x and width properties. Initially, the widget is given infinite width to create its content. Then, when the content is created, the widget width is set to the content width.
Property type:
bool
Possible values:
- true
- false
Default value:
false
Usage examples:
In EzLang files:
- Layout:
- Label:
auto_scale_width: trueIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_auto_scale_width(true);
run(root_widget, state_tree, scheduler);This property automatically scales the height of the widget to its content. This property has priority over the size_hint_y and height properties. Initially, the widget is given infinite height to create its content. Then, when the content is created, the widget height is set to the content height.
Property type:
bool
Possible values:
- true
- false
Default value:
false
Usage examples:
In EzLang files:
- Layout:
- Label:
auto_scale_height: trueIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_auto_scale_height(true);
run(root_widget, state_tree, scheduler);This is an EzLang convenience that allows you to set 'auto_scale_width' and 'auto_scale_height' at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
auto_scale: true, true
This property determines if, and how many, empty pixels should be above the widget. This allows you to create space between widgets, or between a widget and the edge of a layout.
Property type:
usize
Possible values:
any usize value
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Label:
padding_top: 2In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_padding_top(2);
run(root_widget, state_tree, scheduler);This property determines if, and how many, empty pixels should be below the widget. This allows you to create space between widgets, or between a widget and the edge of a layout.
Property type:
usize
Possible values:
any usize value
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Label:
padding_bottom: 2In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_padding_bottom(2);
run(root_widget, state_tree, scheduler);This property determines if, and how many, empty pixels should be added to the left of the widget. This allows you to create space between widgets, or between a widget and the edge of a layout.
Property type:
usize
Possible values:
any usize value
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Label:
padding_left: 2In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_padding_left(2);
run(root_widget, state_tree, scheduler);This property determines if, and how many, empty pixels should be added to the right of the widget. This allows you to create space between widgets, or between a widget and the edge of a layout.
Property type:
usize
Possible values:
any usize value
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Label:
padding_right: 2In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_padding_top(2);
run(root_widget, state_tree, scheduler);This is an EzLang convenience that allows you to set 'pos_left' and 'padding_right', at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
padding_x: 2, 2This is an EzLang convenience that allows you to set 'pos_top' and 'padding_bottom', at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
padding_y: 2, 2This is an EzLang convenience that allows you to set 'pos_top', 'padding_bottom', 'padding_left' and 'padding_right' at the same time (in that order). See the individual properties for more info.
Usage examples:
In EzLang files:
- Layout:
- Label:
padding: 2, 2, 2, 2This property aligns the widget horizontally; this only works if the parent layout is in box mode with orientation vertical, or if the parent layout is in table mode.
Property type:
HorizontalAlignment
Possible values:
- left
- center
- right
Default value:
left
Usage examples:
In EzLang files:
- Layout:
mode: box
orientation: vertical
- Label:
halign: rightIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_halign(HorizontalAlignment::Right);
run(root_widget, state_tree, scheduler);This property aligns the widget vertically; this only works if the parent layout is in box mode with orientation horizontal, or if the parent layout is in table mode.
Property type:
HorizontalAlignment
Possible values:
- top
- middle
- bottom
Default value:
top
Usage examples:
In EzLang files:
- Layout:
mode: box
orientation: horizontal
- Label:
valign: bottomIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_valign(VerticalAlignment::Bottom);
run(root_widget, state_tree, scheduler);If set to true, disables the widget for all callbacks. E.g., button cannot be pressed, layout cannot scroll, etc.
Property type:
bool
Possible values:
- true
- false
Default value:
false
Usage examples:
In EzLang files:
- Layout:
- Button:
disabled: trueIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_button").as_layout_mut();
state.set_disabled(true);
run(root_widget, state_tree, scheduler);The global order in which this widget will be selected by keyboard arrows up/down. Pressing keyboard down increases the order (1>2>3) and keyboard up the opposite (3>2>1). These number do not have to be sequential, so 1>5>10 works as well. The number 0 means no order (cannot select).
Property type:
usize
Possible values:
0 (cannot select), or any usize number above (can select)
Default value:
0
Usage examples:
In EzLang files:
- Layout:
- Button:
selection_order: 10In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_selection_order(10);
run(root_widget, state_tree, scheduler);If set to true, draws a border around the widget. Uses border_fg_color and border_bg_color for coloring. You can set the symbols using horizontal_symbol, vertical_symbol, top_left_symbol, top_right_symbol, bottom_left_symbol and bottom_right_symbol.
Property type:
bool
Possible values:
- true
- false
Default value:
false
Usage examples:
In EzLang files:
- Layout:
- Label:
border: trueIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
state.set_border(true);
run(root_widget, state_tree, scheduler);Sets the horizontal symbol used to draw a border; only works when border is set to true.
Property type:
String
Possible values:
Any String 1 character long
Default value:
─
Usage examples:
In EzLang files:
- Layout:
- Label:
border: true
horizontal_symbol: #In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Border properties are grouped in a BorderConfig object, which we must access first:
state.get_border_config().set_horizontal_symbol("#");
run(root_widget, state_tree, scheduler);Sets the vertical symbol used to draw a border; only works when border is set to true.
Property type:
String
Possible values:
Any String 1 character long
Default value:
│
Usage examples:
In EzLang files:
- Layout:
- Label:
border: true
vertical_symbol: #In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Border properties are grouped in a BorderConfig object, which we must access first:
state.get_border_config().set_vertical_symbol("#");
run(root_widget, state_tree, scheduler);Sets the top left symbol used to draw a border; only works when border is set to true.
Property type:
String
Possible values:
Any String 1 character long
Default value:
┌
Usage examples:
In EzLang files:
- Layout:
- Label:
border: true
top_left_symbol: #In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Border properties are grouped in a BorderConfig object, which we must access first:
state.get_border_config().set_top_left_symbol("#");
run(root_widget, state_tree, scheduler);Sets the top right symbol used to draw a border; only works when border is set to true.
Property type:
String
Possible values:
Any String 1 character long
Default value:
┐
Usage examples:
In EzLang files:
- Layout:
- Label:
border: true
top_right_symbol: #In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Border properties are grouped in a BorderConfig object, which we must access first:
state.get_border_config().set_top_right_symbol("#");
run(root_widget, state_tree, scheduler);Sets the bottom left symbol used to draw a border; only works when border is set to true.
Property type:
String
Possible values:
Any String 1 character long
Default value:
└
Usage examples:
In EzLang files:
- Layout:
- Label:
border: true
bottom_left_symbol: #In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Border properties are grouped in a BorderConfig object, which we must access first:
state.get_border_config().set_bottom_left_symbol("#");
run(root_widget, state_tree, scheduler);Sets the bottom right symbol used to draw a border; only works when border is set to true.
Property type:
String
Possible values:
Any String 1 character long
Default value:
┘
Usage examples:
In EzLang files:
- Layout:
- Label:
border: true
bottom_right_symbol: #In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Border properties are grouped in a BorderConfig object, which we must access first:
state.get_border_config().set_bottom_right_symbol("#");
run(root_widget, state_tree, scheduler);Foreground color used for the widget, i.e. the color used for the symbol of the pixel.
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
white
Usage examples:
In EzLang files:
- Layout:
- Label:
fg_color: red- Layout:
- Label:
fg_color: 255, 0, 0In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_fg_color(Color::Red);
state.get_color_config_mut().set_fg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Background color used for the widget, i.e. the empty space around the symbol of the pixel.
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
Black
Usage examples:
In EzLang files:
- Layout:
- Label:
bg_color: red- Layout:
- Label:
bg_color: 255, 0, 0In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_bg_color(Color::Red);
state.get_color_config_mut().set_bg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Foreground color used for the widget when it is selected (through keyboard up/down, mouse hover, or scheduler method).
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
yellow
Usage examples:
In EzLang files:
- Layout:
- Label:
selection_fg_color: red- Layout:
- Label:
selection_fg_color: 255, 0, 0In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_label").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_selection_fg_color(Color::Red);
state.get_color_config_mut().set_selection_fg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Background color used for the widget when it is selected (through keyboard up/down, mouse hover, or scheduler method).
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
blue
Usage examples:
In EzLang files:
- Layout:
- Label:
selection_bg_color: red- Layout:
- Label:
selection_bg_color: 255, 0, 0In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_layout").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_selection_bg_color(Color::Red);
state.get_color_config_mut().set_selection_bg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Foreground color used for the widget when it is disabled.
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
white
Usage examples:
In EzLang files:
- Layout:
- Label:
disabled_fg_color: red- Layout:
- Label:
disabled_fg_color: 255, 0, 0In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_layout").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_disabled_fg_color(Color::Red);
state.get_color_config_mut().set_disabled_fg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Background color used for the widget when it is disabled.
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
white
Usage examples:
In EzLang files:
- Layout:
- Label:
disabled_bg_color: red- Layout:
- Label:
disabled_bg_color: 255, 0, 0In code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_layout").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_disabled_bg_color(Color::Red);
state.get_color_config_mut().set_disabled_bg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Foreground color used for the border of a widget if enabled.
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
white
Usage examples:
In EzLang files:
- Layout:
- Label:
border_fg_color: red
border: true- Layout:
- Label:
border_fg_color: 255, 0, 0
border: trueIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_layout").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_border_fg_color(Color::Red);
state.get_color_config_mut().set_border_fg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);Background color used for the border of a widget if enabled.
Property type:
Color
Possible values:
- RGB value: 0-255, 0-255, 0-255
- Color words:
- black
- blue
- dark_blue
- cyan
- dark_cyan
- green
- dark_green
- grey
- dark_grey
- magenta
- dark_magenta
- red
- dark_red
- white
- yellow
- dark_yellow
Default value:
white
Usage examples:
In EzLang files:
- Layout:
- Label:
border_bg_color: red
border: true- Layout:
- Label:
border_bg_color: 255, 0, 0
border: trueIn code:
use ez_term::*;
use ez_term::GenericState;
let (root_widget, mut state_tree, mut scheduler) = load_ui();
let state = state_tree.get_mut("my_layout").as_layout_mut();
// Table properties are wrapping into a TableConfig object, which we have to retrieve
// first:
state.get_color_config_mut().set_border_bg_color(Color::Red);
state.get_color_config_mut().set_border_bg_color(Color::from((255, 0, 0)));
run(root_widget, state_tree, scheduler);
Tutorial
Tutorial-Project-StructureMinimal example
EzLang
EzLang basics
EzLang Templates
Ezlang Layout modes
EzLang Box mode layouts
EzLang Stack mode layouts
EzLang Table mode layouts
EzLang Float mode layouts
EzLang Tab mode layouts
EzLang Screen mode layouts
EzLang Layout Scrolling
EzLang Layout Views
EzLang Widget overview
EzLang Label
EzLang Text Input
EzLang Button
EzLang Checkbox
EzLang Radio button
EzLang Dropdown
EzLang Slider
EzLang Canvas
EzLang Property Binding
EzLang Sizing
EzLang Size hints
EzLang Auto scaling
EzLang Maths Sizing
EzLang Manual Sizing
EzLang Positioning
EzLang Layout Mode Positioning
EzLang Position Hints
EzLang Position Maths
EzLang Manual Position
EzLang Adjusting Position
EzLang Keyboard Selection
Scheduler
Widget States and the State Tree
The Scheduler Object
Managing callbacks
Callback Structure
Callback Configs
Callback: On keyboard enter
Callback: On Left Mouse Click
Callback: On Press
Callback: On Select
Callback: On Deselect
Callback: On Right Mouse Click
Callback: On Hover
Callback: On Drag
Callback: On Scroll Up
Callback: On Scroll Down
Callback: On Value Change
Callback: Custom Key Binds
Callback: Global Key Binds
Callback: Property Binds
Tasks
Scheduled Single Exectution Tasks
Scheduled Recurring Tasks
Threaded Tasks
Custom Properties
Modals
Programmatic Widgets
Updating widgets
Managing selection
Default global (key)binds
Performance
Examples
Layout: Box Mode NestedLayout: Box Mode Size Hints
Layout: Stack Mode
Layout: Table Mode Dynamic
Layout: Table Mode Static
Layout: Float Mode Manual
Layout: Float Mode Position hints
Layout: Screen Mode
Layout: Tab Mode
Layout: Scrolling
Layout: Views
Widget: Label
Widget: Text input
Widget: Button
Widget: Checkbox
Widget: Radio Button
Widget: Dropdown
Widget: Slider
Widget: Progress Bar
Widget: Canvas
Scheduler: Schedule Once
Scheduler: Schedule Once Callback
Scheduler: Schedule Recurring
Scheduler: Schedule Recurring Callback
Scheduler: Threaded Task State Tree
Scheduler: Threaded Task Custom Property
Scheduler: Create Widgets
Scheduler: Modal Popup
Reference
WidgetsCommon Properties
Label
Text Input
Button
Checkbox
Radio button
Dropdown
Slider
Canvas
Scheduler
Schedule once
Schedule Recurring
Schedule Threaded
Cancel Task
Cancel Recurring Task
Create Widget
Remove Widget
Select Widget
Deselect Widget
Update Widget
Force Redraw
Open Modal
Dismiss Modal
Bind Global Key
Remove Global Key
Clear Global Keys
Bind Property
Create Custom Properties
Get Property
Get Property Mut
Overwrite Callback Config
Update Callback Config
Exit