wxStaticText(3)

πŸ“¦
version 29.0.6 Β· 3 versions
, in ubuntu stonking

πŸ¦‹ wxStaticText(3) β€” Erlang Module Definition πŸ¦‹

okay bestie sit down, hydrate, and let me tell you about wxStaticText, the wxStaticText(3) page from the Erlang module definitions. it's giving "quiet little label that does exactly what it says on the tin" and honestly? we stan a low-drama control. πŸ’…


🌸 NAME 🌸

wxStaticText β€” a static text control displays one or more lines of read-only text. that's it, that's the whole personality. read-only, no notes, no cap. πŸ“–


✨ DESCRIPTION ✨

okay so here's the tea: wxStaticText supports the three classic text alignments, it does label ellipsization (that's when you replace parts of the text with the ellipsis, literally "...", if the label doesn't fit into the provided space), and it also does formatting markup with wxControl::SetLabelMarkup() β€” which, heads up, is not implemented in wx. πŸ™ˆ

πŸŽ€ Styles πŸŽ€

this class supports the following styles, and no we are not skipping any of them:

  • wxALIGN_LEFT β€” align the text to the left.
  • wxALIGN_RIGHT β€” align the text to the right.
  • wxALIGN_CENTRE_HORIZONTAL β€” center the text (horizontally).
  • wxST_NO_AUTORESIZE β€” by default, the control will adjust its size to exactly fit to the size of the text when setLabel/2 is called. if this style flag is given, the control will not change its size. this style is especially useful with controls which also have the wxALIGN_RIGHT or the wxALIGN_CENTRE_HORIZONTAL style, because otherwise they won't make sense any longer after a call to setLabel/2. lowkey a whole plot twist ngl.
  • wxST_ELLIPSIZE_START β€” if the labeltext width exceeds the control width, replace the beginning of the label with an ellipsis; uses wxControl::Ellipsize (not implemented in wx).
  • wxST_ELLIPSIZE_MIDDLE β€” if the label text width exceeds the control width, replace the middle of the label with an ellipsis; uses wxControl::Ellipsize (not implemented in wx).
  • wxST_ELLIPSIZE_END β€” if the label text width exceeds the control width, replace the end of the label with an ellipsis; uses wxControl::Ellipsize (not implemented in wx).

See: 🫢

  • wxStaticBitmap
  • wxStaticBox

This class is derived, and can use functions, from:

  • wxControl
  • wxWindow
  • wxEvtHandler

family tree ate, fr fr. 🌈

wxWidgets docs: wxStaticText


πŸ’œ DATA TYPES πŸ’œ

wxStaticText() :: wx:wx_object().

one type, one legend. ⭐


πŸ‘‘ FUNCTIONS πŸ‘‘

πŸ“ create/5

create(This, Parent, Id, Label, [Option]) -> boolean()
                when
                    This :: wxStaticText(),
                    Parent :: wxWindow:wxWindow(),
                    Id :: integer(),
                    Label :: unicode:chardata(),
                    Option ::
                        {pos, {X :: integer(), Y :: integer()}} |
                        {size, {W :: integer(), H :: integer()}} |
                        {style, integer()}.

creation function, for two-step construction. that's the whole vibe β€” you build it in two separate moments like a lil glow-up montage. ✨

for details see new/4.

🧚 destroy/1

destroy(This :: wxStaticText()) -> ok.

destroys the object. bye bestie, it was real. πŸ’€

🌸 getLabel/1

getLabel(This) -> unicode:charlist() when This :: wxStaticText().

returns the control's label, as it was passed to wxControl:setLabel/2.

note that the returned string may contains mnemonics ("&" characters) if they were passed to the wxControl:setLabel/2 function; use GetLabelText() (not implemented in wx) if they are undesired.

also note that the returned string is always the string which was passed to wxControl:setLabel/2 but may be different from the string passed to SetLabelText() (not implemented in wx) (since this last one escapes mnemonic characters). the way that & keeps popping up... 😭

πŸ¦‹ new/0

new() -> wxStaticText().

default constructor. no args, no stress, main character energy. πŸ‘‘

πŸ’– new/4

new(Parent, Id, Label, [Option]) -> wxStaticText()
             when
                 Parent :: wxWindow:wxWindow(),
                 Id :: integer(),
                 Label :: unicode:chardata(),
                 Option ::
                     {pos, {X :: integer(), Y :: integer()}} |
                     {size, {W :: integer(), H :: integer()}} |
                     {style, integer()}.

constructor, creating and showing a text control. iconic β€” it does both in one go, no waiting around. πŸ”₯

See: create/5

πŸ’… setLabel/2

setLabel(This, Label) -> ok
                  when
                      This :: wxStaticText(),
                      Label :: unicode:chardata().

change the label shown in the control. so simple. so powerful.

notice that since wxWidgets 3.1.1 this function is guaranteed not to do anything if the label didn't really change, so there is no benefit to checking if the new label is different from the current one in the application code. literally zero benefit, don't waste your precious code lines bestie. πŸ™ˆ

See: wxControl:setLabel/2

πŸŽ€ wrap/2

wrap(This, Width) -> ok
              when This :: wxStaticText(), Width :: integer().

this functions wraps the controls label so that each of its lines becomes at most width pixels wide if possible (the lines are broken at words boundaries so it might not be the case if words are too long). long words said "not today". 😌

if width is negative, no wrapping is done. note that this width is not necessarily the total width of the control, since a few pixels for the border (depending on the controls border style) may be added.

Since: 2.6.2 β€” a classic, an elder, an icon. ⭐


okay that's genuinely the whole page, no skips, no summaries, every flag accounted for. vibe check: passed. βœ…

and that's a wrap (pun fully intended 🎁) β€” this lil love letter came to you from Ericsson AB, wx 2.6, and it lives at wxStaticText(3). slay, bye, go label something. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒˆ

πŸ“¦ where this page comes from