]>
Commit | Line | Data |
---|---|---|
1 | \section{\class{wxStaticText}}\label{wxstatictext} | |
2 | ||
3 | A static text control displays one or more lines of read-only text. | |
4 | ||
5 | \wxheading{Derived from} | |
6 | ||
7 | \helpref{wxControl}{wxcontrol}\\ | |
8 | \helpref{wxWindow}{wxwindow}\\ | |
9 | \helpref{wxEvtHandler}{wxevthandler}\\ | |
10 | \helpref{wxObject}{wxobject} | |
11 | ||
12 | \wxheading{Include files} | |
13 | ||
14 | <wx/stattext.h> | |
15 | ||
16 | \wxheading{Window styles} | |
17 | ||
18 | \twocolwidtha{5cm} | |
19 | \begin{twocollist}\itemsep=0pt | |
20 | \twocolitem{\windowstyle{wxALIGN\_LEFT}}{Align the text to the left} | |
21 | \twocolitem{\windowstyle{wxALIGN\_RIGHT}}{Align the text to the right} | |
22 | \twocolitem{\windowstyle{wxALIGN\_CENTRE}}{Center the text (horizontally)} | |
23 | \twocolitem{\windowstyle{wxST\_NO\_AUTORESIZE}}{By default, the control will | |
24 | adjust its size to exactly fit to the size of the text when | |
25 | \helpref{SetLabel}{wxstatictextsetlabel} is called. If this style flag is | |
26 | given, the control will not change its size (this style is especially useful | |
27 | with controls which also have wxALIGN\_RIGHT or CENTER style because otherwise | |
28 | they won't make sense any longer after a call to SetLabel)} | |
29 | \end{twocollist} | |
30 | ||
31 | See also \helpref{window styles overview}{windowstyles}. | |
32 | ||
33 | \wxheading{See also} | |
34 | ||
35 | \helpref{wxStaticBitmap}{wxstaticbitmap}, \helpref{wxStaticBox}{wxstaticbox} | |
36 | ||
37 | \latexignore{\rtfignore{\wxheading{Members}}} | |
38 | ||
39 | ||
40 | \membersection{wxStaticText::wxStaticText}\label{wxstatictextconstr} | |
41 | ||
42 | \func{}{wxStaticText}{\void} | |
43 | ||
44 | Default constructor. | |
45 | ||
46 | \func{}{wxStaticText}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp | |
47 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp | |
48 | \param{long}{ style = 0}, \param{const wxString\& }{name = ``staticText"}} | |
49 | ||
50 | Constructor, creating and showing a text control. | |
51 | ||
52 | \wxheading{Parameters} | |
53 | ||
54 | \docparam{parent}{Parent window. Should not be NULL.} | |
55 | ||
56 | \docparam{id}{Control identifier. A value of -1 denotes a default value.} | |
57 | ||
58 | \docparam{label}{Text label.} | |
59 | ||
60 | \docparam{pos}{Window position.} | |
61 | ||
62 | \docparam{size}{Window size.} | |
63 | ||
64 | \docparam{style}{Window style. See \helpref{wxStaticText}{wxstatictext}.} | |
65 | ||
66 | \docparam{name}{Window name.} | |
67 | ||
68 | \wxheading{See also} | |
69 | ||
70 | \helpref{wxStaticText::Create}{wxstatictextcreate} | |
71 | ||
72 | ||
73 | \membersection{wxStaticText::Create}\label{wxstatictextcreate} | |
74 | ||
75 | \func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID}{ id},\rtfsp | |
76 | \param{const wxString\& }{label}, \param{const wxPoint\& }{pos = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp | |
77 | \param{long}{ style = 0}, \param{const wxString\& }{name = ``staticText"}} | |
78 | ||
79 | Creation function, for two-step construction. For details see \helpref{wxStaticText::wxStaticText}{wxstatictextconstr}. | |
80 | ||
81 | ||
82 | \membersection{wxStaticText::GetLabel}\label{wxstatictextgetlabel} | |
83 | ||
84 | \constfunc{wxString}{GetLabel}{\void} | |
85 | ||
86 | Returns the contents of the control. | |
87 | ||
88 | ||
89 | \membersection{wxStaticText::SetLabel}\label{wxstatictextsetlabel} | |
90 | ||
91 | \func{virtual void}{SetLabel}{\param{const wxString\& }{ label}} | |
92 | ||
93 | Sets the static text label and updates the controls size to exactly fit the | |
94 | label unless the control has wxST\_NO\_AUTORESIZE flag. | |
95 | ||
96 | \wxheading{Parameters} | |
97 | ||
98 | \docparam{label}{The new label to set. It may contain newline characters.} | |
99 | ||
100 | ||
101 | \membersection{wxStaticText::Wrap}\label{wxstatictextwrpa} | |
102 | ||
103 | \func{void}{Wrap}{\param{int }{width}} | |
104 | ||
105 | This functions wraps the controls label so that each of its lines becomes at | |
106 | most \arg{width} pixels wide if possible (the lines are broken at words | |
107 | boundaries so it might not be the case if words are too long). If \arg{width} | |
108 | is negative, no wrapping is done. | |
109 | ||
110 | \newsince{2.6.2} | |
111 |