Skip to content

Tutorial EzLang Sizing

ddbnl edited this page Aug 30, 2022 · 1 revision

Now we'll learn about the different ways to size widgets and layouts.

The width and height of a widget are controlled separately through their 'width' and 'height' properties. The default settings for all layouts and widgets is to use size hints for sizing. Therefore, make sure you read the size hint page coming up to understand this behavior, so you can use it to your advantage, or disable it when needed. There are four ways to size widgets and layouts:

  • Size relative to parent layout - size hints (default);
  • Auto scale to content;
  • Absolute size - Manual;
  • Absolute size - Maths.

Which one you use in each situation depends entirely on the situation.

If you need your widget or layout to only be as large as it needs to be to display content, then auto scale sizing is the best choice.

If you want to divide a parent layout into multiple widgets (e.g. one widget will be 25% width of the parent layout, the other 75%) then size hints are your best bet, as their ratios will be kept intact even when the window resizes.

If you need more control than size hints allow, the next best choice is using maths; for example, you can auto scale the width of 'widget_one', and then set the width of 'widget_two' to "parent.width - widget_one.width"; that way widget_two will always be the width that remains in the parent layout.

Finally, if you need your widget to always be an exact size, then manual sizing is the way to go. However, keep in mind that this is entirely static, even when the window resizes.

Let's look at size hints first now.

Continue

The general tutorial continues with: EzLang Size hints.

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