1 /////////////////////////////////////////////////////////////////////////////
2 // Program: wxWidgets Widgets Sample
4 // Purpose: part of the widgets sample showing wxTextCtrl
5 // Author: Vadim Zeitlin
8 // Copyright: (c) 2001 Vadim Zeitlin
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx/wx.h".
21 #include "wx/wxprec.h"
27 // for all others, include the necessary headers
32 #include "wx/bitmap.h"
33 #include "wx/button.h"
34 #include "wx/checkbox.h"
35 #include "wx/radiobox.h"
36 #include "wx/statbox.h"
37 #include "wx/stattext.h"
38 #include "wx/textctrl.h"
39 #include "wx/msgdlg.h"
43 #include "wx/ioswrap.h"
47 #include "icons/text.xpm"
49 // ----------------------------------------------------------------------------
51 // ----------------------------------------------------------------------------
56 TextPage_Reset
= wxID_HIGHEST
,
64 TextPage_StreamRedirector
,
71 // textctrl line number radiobox values
79 // wrap style radio box
91 // textctrl kind values
102 // default values for the controls
103 static const struct ControlValues
119 TextLines_Multi
, // multiline
120 false, // not password
121 false, // not readonly
122 true, // do process enter
123 false, // not filename
124 WrapStyle_Word
, // wrap on word boundaries
126 TextKind_Plain
// plain EDIT control
130 // ----------------------------------------------------------------------------
132 // ----------------------------------------------------------------------------
134 // Define a new frame type: this is going to be our main frame
135 class TextWidgetsPage
: public WidgetsPage
139 TextWidgetsPage(WidgetsBookCtrl
*book
, wxImageList
*imaglist
);
140 virtual ~TextWidgetsPage(){};
142 virtual wxControl
*GetWidget() const { return m_text
; }
143 virtual wxTextEntryBase
*GetTextEntry() const { return m_text
; }
144 virtual void RecreateWidget() { CreateText(); }
146 // lazy creation of the content
147 virtual void CreateContent();
150 // create an info text contorl
151 wxTextCtrl
*CreateInfoText();
153 // create a horz sizer holding a static text and this text control
154 wxSizer
*CreateTextWithLabelSizer(const wxString
& label
,
156 const wxString
& label2
= wxEmptyString
,
157 wxTextCtrl
*text2
= NULL
);
160 void OnButtonReset(wxCommandEvent
& event
);
161 void OnButtonClearLog(wxCommandEvent
& event
);
163 void OnButtonSet(wxCommandEvent
& event
);
164 void OnButtonAdd(wxCommandEvent
& event
);
165 void OnButtonInsert(wxCommandEvent
& event
);
166 void OnButtonClear(wxCommandEvent
& event
);
167 void OnButtonLoad(wxCommandEvent
& event
);
169 void OnStreamRedirector(wxCommandEvent
& event
);
170 void OnButtonQuit(wxCommandEvent
& event
);
172 void OnText(wxCommandEvent
& event
);
173 void OnTextEnter(wxCommandEvent
& event
);
174 void OnTextPasted(wxClipboardTextEvent
& event
);
176 void OnCheckOrRadioBox(wxCommandEvent
& event
);
178 void OnUpdateUIClearButton(wxUpdateUIEvent
& event
);
180 void OnUpdateUIPasswordCheckbox(wxUpdateUIEvent
& event
);
181 void OnUpdateUIWrapLinesCheckbox(wxUpdateUIEvent
& event
);
183 void OnUpdateUIResetButton(wxUpdateUIEvent
& event
);
185 void OnIdle(wxIdleEvent
& event
);
187 // reset the textctrl parameters
190 // (re)create the textctrl
193 // is the control currently single line?
194 bool IsSingleLine() const
196 return m_radioTextLines
->GetSelection() == TextLines_Single
;
202 // the radiobox to choose between single and multi line
203 wxRadioBox
*m_radioTextLines
;
205 // and another one to choose the wrapping style
206 wxRadioBox
*m_radioWrap
;
208 // the checkboxes controlling text ctrl styles
209 wxCheckBox
*m_chkPassword
,
214 // under MSW we test rich edit controls as well here
216 wxRadioBox
*m_radioKind
;
219 // the textctrl itself and the sizer it is in
221 wxSizer
*m_sizerText
;
223 // the information text zones
224 wxTextCtrl
*m_textPosCur
,
233 // and the data to show in them
239 wxString m_range10_20
;
242 // any class wishing to process wxWidgets events must use this macro
243 DECLARE_EVENT_TABLE()
244 DECLARE_WIDGETS_PAGE(TextWidgetsPage
)
247 // ----------------------------------------------------------------------------
249 // ----------------------------------------------------------------------------
251 class WidgetsTextCtrl
: public wxTextCtrl
254 WidgetsTextCtrl(wxWindow
*parent
,
256 const wxString
& value
,
258 : wxTextCtrl(parent
, id
, value
, wxDefaultPosition
, wxDefaultSize
, flags
)
263 void OnRightClick(wxMouseEvent
& event
)
267 switch ( HitTest(event
.GetPosition(), &x
, &y
) )
270 wxFAIL_MSG( wxT("unexpected HitTest() result") );
273 case wxTE_HT_UNKNOWN
:
275 where
= wxT("nowhere near");
279 where
= wxT("before");
283 where
= wxT("below");
287 where
= wxT("beyond");
290 case wxTE_HT_ON_TEXT
:
295 wxLogMessage(wxT("Mouse is %s (%ld, %ld)"), where
.c_str(), x
, y
);
301 DECLARE_EVENT_TABLE()
304 // ----------------------------------------------------------------------------
306 // ----------------------------------------------------------------------------
308 BEGIN_EVENT_TABLE(TextWidgetsPage
, WidgetsPage
)
309 EVT_IDLE(TextWidgetsPage::OnIdle
)
311 EVT_BUTTON(TextPage_Reset
, TextWidgetsPage::OnButtonReset
)
313 EVT_BUTTON(TextPage_StreamRedirector
, TextWidgetsPage::OnStreamRedirector
)
315 EVT_BUTTON(TextPage_Clear
, TextWidgetsPage::OnButtonClear
)
316 EVT_BUTTON(TextPage_Set
, TextWidgetsPage::OnButtonSet
)
317 EVT_BUTTON(TextPage_Add
, TextWidgetsPage::OnButtonAdd
)
318 EVT_BUTTON(TextPage_Insert
, TextWidgetsPage::OnButtonInsert
)
319 EVT_BUTTON(TextPage_Load
, TextWidgetsPage::OnButtonLoad
)
321 EVT_UPDATE_UI(TextPage_Clear
, TextWidgetsPage::OnUpdateUIClearButton
)
323 EVT_UPDATE_UI(TextPage_Password
, TextWidgetsPage::OnUpdateUIPasswordCheckbox
)
324 EVT_UPDATE_UI(TextPage_WrapLines
, TextWidgetsPage::OnUpdateUIWrapLinesCheckbox
)
326 EVT_UPDATE_UI(TextPage_Reset
, TextWidgetsPage::OnUpdateUIResetButton
)
328 EVT_TEXT(TextPage_Textctrl
, TextWidgetsPage::OnText
)
329 EVT_TEXT_ENTER(TextPage_Textctrl
, TextWidgetsPage::OnTextEnter
)
330 EVT_TEXT_PASTE(TextPage_Textctrl
, TextWidgetsPage::OnTextPasted
)
332 EVT_CHECKBOX(wxID_ANY
, TextWidgetsPage::OnCheckOrRadioBox
)
333 EVT_RADIOBOX(wxID_ANY
, TextWidgetsPage::OnCheckOrRadioBox
)
336 BEGIN_EVENT_TABLE(WidgetsTextCtrl
, wxTextCtrl
)
337 EVT_RIGHT_UP(WidgetsTextCtrl::OnRightClick
)
340 // ============================================================================
342 // ============================================================================
344 #if defined(__WXX11__)
345 #define FAMILY_CTRLS NATIVE_CTRLS
346 #elif defined(__WXUNIVERSAL__)
347 #define FAMILY_CTRLS UNIVERSAL_CTRLS
349 #define FAMILY_CTRLS NATIVE_CTRLS
352 IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage
, wxT("Text"),
353 FAMILY_CTRLS
| EDITABLE_CTRLS
356 // ----------------------------------------------------------------------------
357 // TextWidgetsPage creation
358 // ----------------------------------------------------------------------------
360 TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl
*book
, wxImageList
*imaglist
)
361 : WidgetsPage(book
, imaglist
, text_xpm
)
368 m_radioTextLines
= (wxRadioBox
*)NULL
;
373 m_chkFilename
= (wxCheckBox
*)NULL
;
383 m_textRange
= (wxTextCtrl
*)NULL
;
385 m_sizerText
= (wxSizer
*)NULL
;
390 m_selTo
= -2; // not -1 which means "no selection"
393 void TextWidgetsPage::CreateContent()
396 static const wxString modes
[] =
402 wxStaticBox
*box
= new wxStaticBox(this, wxID_ANY
, wxT("&Set textctrl parameters"));
403 m_radioTextLines
= new wxRadioBox(this, wxID_ANY
, wxT("&Number of lines:"),
404 wxDefaultPosition
, wxDefaultSize
,
405 WXSIZEOF(modes
), modes
,
406 1, wxRA_SPECIFY_COLS
);
408 wxSizer
*sizerLeft
= new wxStaticBoxSizer(box
, wxVERTICAL
);
410 sizerLeft
->Add(m_radioTextLines
, 0, wxGROW
| wxALL
, 5);
411 sizerLeft
->AddSpacer(5);
413 m_chkPassword
= CreateCheckBoxAndAddToSizer(
414 sizerLeft
, wxT("&Password control"), TextPage_Password
416 m_chkReadonly
= CreateCheckBoxAndAddToSizer(
417 sizerLeft
, wxT("&Read-only mode")
419 m_chkProcessEnter
= CreateCheckBoxAndAddToSizer(
420 sizerLeft
, wxT("Process &Enter")
422 m_chkFilename
= CreateCheckBoxAndAddToSizer(
423 sizerLeft
, wxT("&Filename control")
425 m_chkFilename
->Disable(); // not implemented yet
426 sizerLeft
->AddSpacer(5);
428 static const wxString wrap
[] =
436 m_radioWrap
= new wxRadioBox(this, wxID_ANY
, wxT("&Wrap style:"),
437 wxDefaultPosition
, wxDefaultSize
,
438 WXSIZEOF(wrap
), wrap
,
439 1, wxRA_SPECIFY_COLS
);
440 sizerLeft
->Add(m_radioWrap
, 0, wxGROW
| wxALL
, 5);
443 static const wxString kinds
[] =
447 wxT("rich edit 2.0"),
450 m_radioKind
= new wxRadioBox(this, wxID_ANY
, wxT("Control &kind"),
451 wxDefaultPosition
, wxDefaultSize
,
452 WXSIZEOF(kinds
), kinds
,
453 1, wxRA_SPECIFY_COLS
);
455 sizerLeft
->AddSpacer(5);
456 sizerLeft
->Add(m_radioKind
, 0, wxGROW
| wxALL
, 5);
459 wxButton
*btn
= new wxButton(this, TextPage_Reset
, wxT("&Reset"));
460 sizerLeft
->Add(2, 2, 0, wxGROW
| wxALL
, 1); // spacer
461 sizerLeft
->Add(btn
, 0, wxALIGN_CENTRE_HORIZONTAL
| wxALL
, 15);
464 wxStaticBox
*box2
= new wxStaticBox(this, wxID_ANY
, wxT("&Change contents:"));
465 wxSizer
*sizerMiddleUp
= new wxStaticBoxSizer(box2
, wxVERTICAL
);
467 btn
= new wxButton(this, TextPage_Set
, wxT("&Set text value"));
468 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
470 btn
= new wxButton(this, TextPage_Add
, wxT("&Append text"));
471 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
473 btn
= new wxButton(this, TextPage_Insert
, wxT("&Insert text"));
474 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
476 btn
= new wxButton(this, TextPage_Load
, wxT("&Load file"));
477 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
479 btn
= new wxButton(this, TextPage_Clear
, wxT("&Clear"));
480 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
482 btn
= new wxButton(this, TextPage_StreamRedirector
, wxT("St&ream redirection"));
483 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
485 wxStaticBox
*box4
= new wxStaticBox(this, wxID_ANY
, wxT("&Info:"));
486 wxSizer
*sizerMiddleDown
= new wxStaticBoxSizer(box4
, wxVERTICAL
);
488 m_textPosCur
= CreateInfoText();
489 m_textRowCur
= CreateInfoText();
490 m_textColCur
= CreateInfoText();
492 wxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
493 sizerRow
->Add(CreateTextWithLabelSizer
499 sizerRow
->Add(CreateTextWithLabelSizer
504 0, wxLEFT
| wxRIGHT
, 5);
505 sizerRow
->Add(CreateTextWithLabelSizer
511 sizerMiddleDown
->Add(sizerRow
, 0, wxALL
, 5);
513 m_textLineLast
= CreateInfoText();
514 m_textPosLast
= CreateInfoText();
517 CreateTextWithLabelSizer
519 wxT("Number of lines:"),
521 wxT("Last position:"),
527 m_textSelFrom
= CreateInfoText();
528 m_textSelTo
= CreateInfoText();
531 CreateTextWithLabelSizer
533 wxT("Selection: from"),
541 m_textRange
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
542 wxDefaultPosition
, wxDefaultSize
,
546 CreateTextWithLabelSizer
548 wxT("Range 10..20:"),
554 wxSizer
*sizerMiddle
= new wxBoxSizer(wxVERTICAL
);
555 sizerMiddle
->Add(sizerMiddleUp
, 0, wxGROW
);
556 sizerMiddle
->Add(sizerMiddleDown
, 1, wxGROW
| wxTOP
, 5);
559 wxStaticBox
*box3
= new wxStaticBox(this, wxID_ANY
, wxT("&Text:"));
560 m_sizerText
= new wxStaticBoxSizer(box3
, wxHORIZONTAL
);
563 m_sizerText
->SetMinSize(150, 0);
565 // the 3 panes panes compose the upper part of the window
566 wxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
567 sizerTop
->Add(sizerLeft
, 0, wxGROW
| (wxALL
& ~wxLEFT
), 10);
568 sizerTop
->Add(sizerMiddle
, 0, wxGROW
| wxALL
, 10);
569 sizerTop
->Add(m_sizerText
, 1, wxGROW
| (wxALL
& ~wxRIGHT
), 10);
574 // ----------------------------------------------------------------------------
576 // ----------------------------------------------------------------------------
578 wxTextCtrl
*TextWidgetsPage::CreateInfoText()
580 static int s_maxWidth
= 0;
584 GetTextExtent(wxT("9999999"), &s_maxWidth
, NULL
);
587 wxTextCtrl
*text
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
589 wxSize(s_maxWidth
, wxDefaultCoord
),
594 wxSizer
*TextWidgetsPage::CreateTextWithLabelSizer(const wxString
& label
,
596 const wxString
& label2
,
599 wxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
600 sizerRow
->Add(new wxStaticText(this, wxID_ANY
, label
), 0,
601 wxALIGN_CENTRE_VERTICAL
| wxRIGHT
, 5);
602 sizerRow
->Add(text
, 0, wxALIGN_CENTRE_VERTICAL
);
605 sizerRow
->Add(new wxStaticText(this, wxID_ANY
, label2
), 0,
606 wxALIGN_CENTRE_VERTICAL
| wxLEFT
| wxRIGHT
, 5);
607 sizerRow
->Add(text2
, 0, wxALIGN_CENTRE_VERTICAL
);
613 // ----------------------------------------------------------------------------
615 // ----------------------------------------------------------------------------
617 void TextWidgetsPage::Reset()
619 m_radioTextLines
->SetSelection(DEFAULTS
.textLines
);
621 m_chkPassword
->SetValue(DEFAULTS
.password
);
622 m_chkReadonly
->SetValue(DEFAULTS
.readonly
);
623 m_chkProcessEnter
->SetValue(DEFAULTS
.processEnter
);
624 m_chkFilename
->SetValue(DEFAULTS
.filename
);
626 m_radioWrap
->SetSelection(DEFAULTS
.wrapStyle
);
629 m_radioKind
->SetSelection(DEFAULTS
.textKind
);
633 void TextWidgetsPage::CreateText()
635 int flags
= ms_defaultFlags
;
636 switch ( m_radioTextLines
->GetSelection() )
639 wxFAIL_MSG( wxT("unexpected lines radio box selection") );
641 case TextLines_Single
:
644 case TextLines_Multi
:
645 flags
|= wxTE_MULTILINE
;
646 m_chkPassword
->SetValue(false);
650 if ( m_chkPassword
->GetValue() )
651 flags
|= wxTE_PASSWORD
;
652 if ( m_chkReadonly
->GetValue() )
653 flags
|= wxTE_READONLY
;
654 if ( m_chkProcessEnter
->GetValue() )
655 flags
|= wxTE_PROCESS_ENTER
;
657 switch ( m_radioWrap
->GetSelection() )
660 wxFAIL_MSG( wxT("unexpected wrap style radio box selection") );
663 flags
|= wxTE_DONTWRAP
; // same as wxHSCROLL
667 flags
|= wxTE_WORDWRAP
;
671 flags
|= wxTE_CHARWRAP
;
675 // this is default but use symbolic file name for consistency
676 flags
|= wxTE_BESTWRAP
;
681 switch ( m_radioKind
->GetSelection() )
684 wxFAIL_MSG( wxT("unexpected kind radio box selection") );
702 valueOld
= m_text
->GetValue();
704 m_sizerText
->Detach( m_text
);
709 valueOld
= wxT("Hello, Universe!");
712 m_text
= new WidgetsTextCtrl(this, TextPage_Textctrl
, valueOld
, flags
);
715 if ( m_chkFilename
->GetValue() )
719 // cast to int needed to silence gcc warning about different enums
720 m_sizerText
->Add(m_text
, 1, wxALL
|
721 (flags
& wxTE_MULTILINE
? (int)wxGROW
723 m_sizerText
->Layout();
726 // ----------------------------------------------------------------------------
728 // ----------------------------------------------------------------------------
730 void TextWidgetsPage::OnIdle(wxIdleEvent
& WXUNUSED(event
))
732 // update all info texts
736 long posCur
= m_text
->GetInsertionPoint();
737 if ( posCur
!= m_posCur
)
739 m_textPosCur
->Clear();
740 m_textRowCur
->Clear();
741 m_textColCur
->Clear();
744 m_text
->PositionToXY(posCur
, &col
, &row
);
746 *m_textPosCur
<< posCur
;
747 *m_textRowCur
<< row
;
748 *m_textColCur
<< col
;
756 long posLast
= m_text
->GetLastPosition();
757 if ( posLast
!= m_posLast
)
759 m_textPosLast
->Clear();
760 *m_textPosLast
<< posLast
;
766 if ( m_textLineLast
)
768 m_textLineLast
->SetValue(
769 wxString::Format(wxT("%d"), m_text
->GetNumberOfLines()) );
772 if ( m_textSelFrom
&& m_textSelTo
)
775 m_text
->GetSelection(&selFrom
, &selTo
);
776 if ( selFrom
!= m_selFrom
)
778 m_textSelFrom
->Clear();
779 *m_textSelFrom
<< selFrom
;
784 if ( selTo
!= m_selTo
)
786 m_textSelTo
->Clear();
787 *m_textSelTo
<< selTo
;
795 wxString range
= m_text
->GetRange(10, 20);
796 if ( range
!= m_range10_20
)
798 m_range10_20
= range
;
799 m_textRange
->SetValue(range
);
804 void TextWidgetsPage::OnButtonReset(wxCommandEvent
& WXUNUSED(event
))
811 void TextWidgetsPage::OnButtonSet(wxCommandEvent
& WXUNUSED(event
))
813 m_text
->SetValue(m_text
->GetWindowStyle() & wxTE_MULTILINE
814 ? wxT("Here,\nthere and\neverywhere")
815 : wxT("Yellow submarine"));
820 void TextWidgetsPage::OnButtonAdd(wxCommandEvent
& WXUNUSED(event
))
822 if ( m_text
->GetWindowStyle() & wxTE_MULTILINE
)
824 m_text
->AppendText(wxT("We all live in a\n"));
827 m_text
->AppendText(wxT("Yellow submarine"));
830 void TextWidgetsPage::OnButtonInsert(wxCommandEvent
& WXUNUSED(event
))
832 m_text
->WriteText(wxT("Is there anybody going to listen to my story"));
833 if ( m_text
->GetWindowStyle() & wxTE_MULTILINE
)
835 m_text
->WriteText(wxT("\nall about the girl who came to stay"));
839 void TextWidgetsPage::OnButtonClear(wxCommandEvent
& WXUNUSED(event
))
845 void TextWidgetsPage::OnButtonLoad(wxCommandEvent
& WXUNUSED(event
))
847 // search for the file in several dirs where it's likely to be
849 pathlist
.Add(wxT("."));
850 pathlist
.Add(wxT(".."));
851 pathlist
.Add(wxT("../../../samples/widgets"));
853 wxString filename
= pathlist
.FindValidPath(wxT("textctrl.cpp"));
856 wxLogError(wxT("File textctrl.cpp not found."));
861 if ( !m_text
->LoadFile(filename
) )
863 // this is not supposed to happen ...
864 wxLogError(wxT("Error loading file."));
868 long elapsed
= sw
.Time();
869 wxLogMessage(wxT("Loaded file '%s' in %lu.%us"),
870 filename
.c_str(), elapsed
/ 1000,
871 (unsigned int) elapsed
% 1000);
876 void TextWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent
& event
)
878 event
.Enable(!m_text
->GetValue().empty());
881 void TextWidgetsPage::OnUpdateUIWrapLinesCheckbox(wxUpdateUIEvent
& event
)
883 event
.Enable( !IsSingleLine() );
886 void TextWidgetsPage::OnUpdateUIPasswordCheckbox(wxUpdateUIEvent
& event
)
888 // can't put multiline control in password mode
889 event
.Enable( IsSingleLine() );
892 void TextWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent
& event
)
894 event
.Enable( (m_radioTextLines
->GetSelection() != DEFAULTS
.textLines
) ||
896 (m_radioKind
->GetSelection() != DEFAULTS
.textKind
) ||
898 (m_chkPassword
->GetValue() != DEFAULTS
.password
) ||
899 (m_chkReadonly
->GetValue() != DEFAULTS
.readonly
) ||
900 (m_chkProcessEnter
->GetValue() != DEFAULTS
.processEnter
) ||
901 (m_chkFilename
->GetValue() != DEFAULTS
.filename
) ||
902 (m_radioWrap
->GetSelection() != DEFAULTS
.wrapStyle
) );
905 void TextWidgetsPage::OnText(wxCommandEvent
& WXUNUSED(event
))
907 // small hack to suppress the very first message: by then the logging is
908 // not yet redirected and so initial setting of the text value results in
909 // an annoying message box
910 static bool s_firstTime
= true;
917 wxLogMessage(wxT("Text ctrl value changed"));
920 void TextWidgetsPage::OnTextEnter(wxCommandEvent
& event
)
922 wxLogMessage(wxT("Text entered: '%s'"), event
.GetString().c_str());
926 void TextWidgetsPage::OnTextPasted(wxClipboardTextEvent
& event
)
928 wxLogMessage("Text pasted from clipboard.");
932 void TextWidgetsPage::OnCheckOrRadioBox(wxCommandEvent
& WXUNUSED(event
))
937 void TextWidgetsPage::OnStreamRedirector(wxCommandEvent
& WXUNUSED(event
))
939 #if wxHAS_TEXT_WINDOW_STREAM
940 wxStreamToTextRedirector
redirect(m_text
);
941 wxString
str( wxT("Outputed to cout, appears in wxTextCtrl!") );
942 wxSTD cout
<< str
<< wxSTD endl
;
944 wxMessageBox(wxT("This wxWidgets build does not support wxStreamToTextRedirector"));