-
Notifications
You must be signed in to change notification settings - Fork 0
Tutorial EzLang Layout Modes Stack
Stack mode stacks widgets inside of the layout according to the primary and secondary orientation. This can be useful if you want a bunch of widgets to fit into a layout efficiently (especially useful if the widgets are many different sizes). Unlike box mode which can either be horizontal or vertical, stack mode has 8 possible orientations. The default orientation is "top-bottom, left-right". This means that objects will be placed from top to bottom until there is no more vertical space to place the next widget. The next widget will then be placed at the top again, to the right of the first widget. In short: widgets are placed in the primary direction until space runs out; then they will be shifted towards the secondary direction. The possible orientations are:
- Top-bottom, left-right ('tb-lr')
- Top-bottom, right-left ('tb-rl')
- Bottom-top, left-right ('bt-lr')
- Bottom-top, right-left ('bt-rl')
- Left-right, top-bottom ('lr-tb')
- Left-right, bottom-top ('lr-bt')
- Right-left, top-bottom ('rl-tb')
- Right-left, bottom-top ('rl-bt')
Here is an example: we have labels of different sizes and we want to place them efficiently in a layout, trying not to waste space. Instead of coming up with a complex solution, we just let the stack layout do the work for us. We want the widgets stacked left-to-right, top-to-bottom:
- <CustomLabel@Label>:
auto_scale: true, true
border: true
- Layout:
mode: stack
orientation: lr-tb
border: true
- CustomLabel:
text: Hi,
- CustomLabel:
text: The size
- CustomLabel:
text: Of these labels
- CustomLabel:
text: Keeps increasing in length!
The widgets will be stacked automatically. If you resize the window, the row and column each widget occupies may change, as the stack layout rearranges the widgets, but the orientation will always be respected.
As you can see, stack layouts are an easy way to make sure your widgets will remain visible even when the window resizes (as long as there is enough space in general of course).
The general tutorial continues with: EzLang Table mode layouts.
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