silk/statictext
A static text control displays one or more lines of read-only text.
wxStaticText supports the three classic text alignments, label ellipsization i.e. replacing parts of the text with the ellipsis (“…”) if the label doesn’t fit into the provided space and also formatting markup with wxControl::SetLabelMarkup() (not implemented in wx).
Derived from WxControl
,
WxWindow
,
WxEvtHandler
Types
pub type Option {
Pos(#(Int, Int))
Size(#(Int, Int))
Style(Int)
}
Constructors
-
Pos(#(Int, Int))
-
Size(#(Int, Int))
-
Style(Int)
pub type WxStaticText =
control.WxControl(types.WxStaticText)
Functions
pub fn create(
this: WxObject(WxWindow(WxControl(WxStaticText))),
parent: WxObject(WxWindow(a)),
id: Int,
label: String,
) -> WxObject(WxWindow(WxControl(WxStaticText)))
Equivalent to create(this, parent, id, label, [])
pub fn create5(
this: WxObject(WxWindow(WxControl(WxStaticText))),
parent: WxObject(WxWindow(a)),
id: Int,
label: String,
option: List(Option),
) -> WxObject(WxWindow(WxControl(WxStaticText)))
Create function, for two-step construction.
pub fn destroy(
this: WxObject(WxWindow(WxControl(WxStaticText))),
) -> OkT
Destroys the object
pub fn get_label(
this: WxObject(WxWindow(WxControl(WxStaticText))),
) -> String
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).
pub fn new3(
parent: WxObject(WxWindow(a)),
id: Int,
label: String,
) -> WxObject(WxWindow(WxControl(WxStaticText)))
Equivalent to new(parent, id, label, [])
pub fn new4(
parent: WxObject(WxWindow(a)),
id: Int,
label: String,
option: List(Option),
) -> WxObject(WxWindow(WxControl(WxStaticText)))
Constructor, creating and showing a text control.
See create
pub fn set_label(
this: WxObject(WxWindow(WxControl(WxStaticText))),
label: String,
) -> OkT
Change the label shown in the control.
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.
See: wxControl:setLabel/2
pub fn wrap(
this: WxObject(WxWindow(WxControl(WxStaticText))),
width: Int,
) -> OkT
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).
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.