Skip to content

Tutorial EzLang Adjusting Position

ddbnl edited this page Aug 30, 2022 · 1 revision

It is not possible to control position in layout modes other that float. In the fixed layout modes it is still possible to adjust position. This can be done with padding and aligning.

Aligning

Aligning can be done horizontally (halign) or vertically (valign). Aligning is only useful if the widget is smaller than the layout.

Halign supports:

  • Left
  • Center
  • Right

Valign supports:

  • Top
  • Middle
  • Bottom

If a widget has "halign: center" and it is less wide than its parent layout, it will be centered horizontally. This can be useful for example in a box mode layout with vertical orientation. In that case, widgets will be stacked vertically and you have no control over horizontal position. By using halign, you can still control whether the widgets go left, right, or in the center. Here is an example of this with a label:

- Layout:
    mode: box
    orientation: vertical
    border: true
    - Label:
        text: Hello world
        auto_scale: true, true
        halign: center
        border: true

37_ez_lang_adjpos

Padding

Padding adds empty space to the left, right, top, and/or bottom of a widget. It allows you to create some space between widgets, create a margin between the border of a layout and a widget, etc. There are 7 different padding properties:

  • padding: left, right, top, bottom (e.g. "padding: 1, 1, 1, 1")
  • padding_x: left, right (e.g. "padding_x: 1, 1")
  • padding_y: top, bottom (e.g. "padding_y: 1, 1")
  • padding_left: left (e.g. "padding_left: 1")
  • padding_right: left (e.g. "padding_right: 1")
  • padding_top: left (e.g. "padding_top: 1")
  • padding_bottom: left (e.g. "padding_bottom: 1")

Here is an example layout with 2 labels without padding:

- Layout:
    mode: box
    orientation: vertical
    border: true
    - Label:
        text: Hello world
        auto_scale: true, true
        border: true
    - Label:
        text: Hello world
        auto_scale: true, true
        border: true

38_ez_lang_adjpos

Here is the same example with padding:

- Layout:
    mode: box
    orientation: vertical
    border: true
    - Label:
        text: Hello world
        padding_left: 1
        padding_bottom: 1
        auto_scale: true, true
        border: true
    - Label:
        text: Hello world
        padding_left: 1
        auto_scale: true, true
        border: true

39_ez_lang_adjpos

Continue

The general tutorial continues with: EzLang Keyboard Selection.

Tutorial Tutorial-Project-Structure
  Minimal 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
ExamplesLayout: Box Mode Nested
Layout: 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 Widgets
  Common 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
Clone this wiki locally