wxSizerFlags(3)
π wxSizerFlags β the Erlang module definition, but make it make sense π
okay so bestie, quick context: this is wxSizerFlags(3), an Erlang module definition. That's the whole header, consider it folded in. Now let's get into it π«Ά
β¨ NAME β¨
wxSizerFlags β a lil container for sizer item flags that gives them readable names, so you're not out here shouting raw integers at your layout. π
πΈ DESCRIPTION πΈ
So like, normally when you add an item to a sizer via wxSizer:add/4, you have to hand over a whole pile of flags and parameters, and it gets unwieldy. Genuinely. It's giving chaos. π
This is where wxSizerFlags comes in: it lets you specify all those parameters using named methods instead. For example, instead of
you can now write
(this page's example snippets did not survive the journey, bestie β just know they were the before-and-after π)
It's way more readable, and it also means you can build wxSizerFlags objects once and reuse them across several sizer items. Iconic behaviour, no cap.
Also, important: by specification, all methods of wxSizerFlags return the wxSizerFlags object itself, so you can chain multiple method calls together like in the examples above. Chain it, slay it, stack it. π₯
- See:
wxSizer - wxWidgets docs:
wxSizerFlags
π DATA TYPES π
wxSizerFlags()::wx:wx_object().
π FUNCTIONS π
align(This, Alignment) -> wxSizerFlags()whenThis::wxSizerFlags(),Alignment::integer().
Sets the alignment of this wxSizerFlags to align.
Heads up: this method replaces the previously set alignment with the one you specified. No merging, no stacking, just swap. π«
See:
left/1right/1centre/1
border(This, [Option]) -> wxSizerFlags()whenThis::wxSizerFlags(),Option::{direction, integer()}.
Sets the wxSizerFlags to have a border with size as returned by GetDefaultBorder() (not implemented in wx).
border(This, Direction, Borderinpixels) -> wxSizerFlags()whenThis::wxSizerFlags(),Direction::integer(),Borderinpixels::integer().
Sets the wxSizerFlags to have a border of a number of pixels specified by borderinpixels, with the directions specified by direction.
Bestie, listen: prefer to use the overload below, orDoubleBorder()(not implemented in wx) orTripleBorder()(not implemented in wx), instead of hard-coding the border value in pixels β that way you dodge the too-small-borders-on-high-DPI-displays tragedy. πβ¨
center(This) -> wxSizerFlags()whenThis::wxSizerFlags().
Sets the object of the wxSizerFlags to center itself in the area it is given. Main character positioning, honestly. π«Ά
centre(This) -> wxSizerFlags()whenThis::wxSizerFlags().
Equivalent to: center/1
destroy(This :: wxSizerFlags()) -> ok.
Destroys the object π
expand(This) -> wxSizerFlags()whenThis::wxSizerFlags().
Sets the object of the wxSizerFlags to expand to fill as much area as it can. It's giving take up space, and we love that for it. π
left(This) -> wxSizerFlags()whenThis::wxSizerFlags().
Aligns the object to the left, similar for Align(wxALIGN_LEFT).
Unlike align/2, this method doesn't change the vertical alignment of the item. Left only, keep it horizontal, iykyk. π
new([Option]) -> wxSizerFlags()whenOption::{proportion, integer()}.
Creates the wxSizer with the proportion specified by proportion.
proportion(This, Proportion) -> wxSizerFlags()whenThis::wxSizerFlags(),Proportion::integer().
Sets the proportion of this wxSizerFlags to proportion.
right(This) -> wxSizerFlags()whenThis::wxSizerFlags().
Aligns the object to the right, similar for Align(wxALIGN_RIGHT).
Unlike align/2, this method doesn't change the vertical alignment of the item. Same energy as left/1 but make it right. π
π k that's the whole page, you understood the assignment, go build something cute. π¦
Sign-off szn: this lil manual came from Ericsson AB, and it's the wx 2.6 version, dated to match the wxSizerFlags(3) page β periodt. π
β¨
π¦ where this page comes from
- ubuntu stonking: erlang-doc 1:29.0.6+dfsg-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms