Skip to content

Tutorial EzLang Layout Modes Table

ddbnl edited this page Aug 27, 2022 · 3 revisions

Table mode divides widgets into rows and columns. You must specify how many rows or columns you want, or both. If you specify the amount of columns, the table will grow the amount of rows to fit all the widgets. If you specify the amount of rows, then the amount of columns will grow. If you specify both, the table will be fixed in size. Like the stack layout, the table layout has 8 possible orientations which dictate in what order the cells of the table are filled. The default orientation is top-bottom, left right ('tb-lr'), so if there are 3 columns and 3 rows (and 9 widgets), they would be filled like this:

1 4 7
2 5 8
3 6 9

If you would set the orientation to left-right, top-bottom ('lr-tb') it would look like this:

1 2 3
4 5 6
7 8 9

Each row in the table is sized to the highest widget in that row. Each column is sized to the widest widget in that column. This behavior can be overwritten using the following properties:

  • row_default_height: 50 (set default height of rows to 50, they can still grow)
  • force_default_row_height: true (force all rows to always be row_default_height)
  • col_default_width: 50 (set default width of columns to 50, they can still grow)
  • force_default_col_width: true (force all columns to always be col_default_width)

Here is an example of creating a Sudoku cell using a table layout. We will recreate this cell:

- - -
3 5 -
9 - 4
- <SudokuLabel@Label>:
    text: -
    size_hint: none, none
    size: 1, 1
    halign: center
    valign: middle

- Layout:
    mode: table
    orientation: lr-tb
    border: true
    auto_scale: true, true

    cols: 3
    col_default_width: 7
    force_default_col_width: true
    row_default_height: 3
    force_default_row_height: true

    - SudokuLabel:
    - SudokuLabel:
    - SudokuLabel:
    - SudokuLabel:
        text: 3
    - SudokuLabel:
        text: 5
    - SudokuLabel:
    - SudokuLabel:
        text: 9
    - SudokuLabel:
    - SudokuLabel:
        text: 4

14_ez_lang_tablemode

Continue

The general tutorial continues with: EzLang Float mode layouts.

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