## wxStaticText

A static text control displays one or more lines of read-only text.

Derived from

wxControl
wxWindow
wxEvtHandler
wxObject

Include files

<wx/stattext.h>

Window styles

wxALIGN_LEFT | Align the text to the left
wxALIGN_RIGHT | Align the text to the right
wxALIGN_CENTRE | Center the text (horisontally)
wxST_NO_AUTORESIZE | By default, the control will adjust its size to exactly fit to the size of the text when SetLabel 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 wxALIGN_RIGHT or CENTER style because otherwise they won't make sense any longer after a call to SetLabel)

See also window styles overview.

See also

wxStaticBitmap, wxStaticBox

Members

wxStaticText::wxStaticText
wxStaticText::Create
wxStaticText::GetLabel
wxStaticText::SetLabel

### wxStaticText::wxStaticText

wxStaticText()

Default constructor.

wxStaticText(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "staticText")

Constructor, creating and showing a text control.

Parameters

parent

Parent window. Should not be NULL.

id

Control identifier. A value of -1 denotes a default value.

label

Text label.

pos

Window position.

size

Window size.

style

Window style. See wxStaticText.

name

Window name.

See also

wxStaticText::Create

### wxStaticText::Create

bool Create(wxWindow* parent, wxWindowID id, const wxString& label, const wxPoint& pos, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = "staticText")

Creation function, for two-step construction. For details see wxStaticText::wxStaticText.

### wxStaticText::GetLabel

wxString GetLabel() const

Returns the contents of the control.

### wxStaticText::SetLabel

virtual void SetLabel(const wxString& label)

Sets the static text label and updates the controls size to exactly fit the label unless the control has wxST_NO_AUTORESIZE flag.

Parameters

label

The new label to set. It may contain newline characters.