1 /////////////////////////////////////////////////////////////////////////////
2 // Program: wxWidgets Widgets Sample
4 // Purpose: part of the widgets sample showing wxTextCtrl
5 // Author: Vadim Zeitlin
7 // Copyright: (c) 2001 Vadim Zeitlin
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx/wx.h".
20 #include "wx/wxprec.h"
26 // for all others, include the necessary headers
31 #include "wx/bitmap.h"
32 #include "wx/button.h"
33 #include "wx/checkbox.h"
34 #include "wx/radiobox.h"
35 #include "wx/statbox.h"
36 #include "wx/stattext.h"
37 #include "wx/textctrl.h"
38 #include "wx/msgdlg.h"
42 #include "wx/ioswrap.h"
46 #include "icons/text.xpm"
48 // ----------------------------------------------------------------------------
50 // ----------------------------------------------------------------------------
55 TextPage_Reset
= wxID_HIGHEST
,
63 TextPage_StreamRedirector
,
70 // textctrl line number radiobox values
78 // wrap style radio box
90 // textctrl kind values
101 // default values for the controls
102 static const struct ControlValues
118 TextLines_Multi
, // multiline
119 false, // not password
120 false, // not readonly
121 true, // do process enter
122 false, // not filename
123 WrapStyle_Word
, // wrap on word boundaries
125 TextKind_Plain
// plain EDIT control
129 // ----------------------------------------------------------------------------
131 // ----------------------------------------------------------------------------
133 // Define a new frame type: this is going to be our main frame
134 class TextWidgetsPage
: public WidgetsPage
138 TextWidgetsPage(WidgetsBookCtrl
*book
, wxImageList
*imaglist
);
139 virtual ~TextWidgetsPage(){};
141 virtual wxControl
*GetWidget() const { return m_text
; }
142 virtual wxTextEntryBase
*GetTextEntry() const { return m_text
; }
143 virtual void RecreateWidget() { CreateText(); }
145 // lazy creation of the content
146 virtual void CreateContent();
149 // create an info text contorl
150 wxTextCtrl
*CreateInfoText();
152 // create a horz sizer holding a static text and this text control
153 wxSizer
*CreateTextWithLabelSizer(const wxString
& label
,
155 const wxString
& label2
= wxEmptyString
,
156 wxTextCtrl
*text2
= NULL
);
159 void OnButtonReset(wxCommandEvent
& event
);
160 void OnButtonClearLog(wxCommandEvent
& event
);
162 void OnButtonSet(wxCommandEvent
& event
);
163 void OnButtonAdd(wxCommandEvent
& event
);
164 void OnButtonInsert(wxCommandEvent
& event
);
165 void OnButtonClear(wxCommandEvent
& event
);
166 void OnButtonLoad(wxCommandEvent
& event
);
168 void OnStreamRedirector(wxCommandEvent
& event
);
169 void OnButtonQuit(wxCommandEvent
& event
);
171 void OnText(wxCommandEvent
& event
);
172 void OnTextEnter(wxCommandEvent
& event
);
173 void OnTextPasted(wxClipboardTextEvent
& event
);
175 void OnCheckOrRadioBox(wxCommandEvent
& event
);
177 void OnUpdateUIClearButton(wxUpdateUIEvent
& event
);
179 void OnUpdateUIPasswordCheckbox(wxUpdateUIEvent
& event
);
180 void OnUpdateUIWrapLinesCheckbox(wxUpdateUIEvent
& event
);
182 void OnUpdateUIResetButton(wxUpdateUIEvent
& event
);
184 void OnIdle(wxIdleEvent
& event
);
186 // reset the textctrl parameters
189 // (re)create the textctrl
192 // is the control currently single line?
193 bool IsSingleLine() const
195 return m_radioTextLines
->GetSelection() == TextLines_Single
;
201 // the radiobox to choose between single and multi line
202 wxRadioBox
*m_radioTextLines
;
204 // and another one to choose the wrapping style
205 wxRadioBox
*m_radioWrap
;
207 // the checkboxes controlling text ctrl styles
208 wxCheckBox
*m_chkPassword
,
213 // under MSW we test rich edit controls as well here
215 wxRadioBox
*m_radioKind
;
218 // the textctrl itself and the sizer it is in
220 wxSizer
*m_sizerText
;
222 // the information text zones
223 wxTextCtrl
*m_textPosCur
,
232 // and the data to show in them
238 wxString m_range10_20
;
241 // any class wishing to process wxWidgets events must use this macro
242 DECLARE_EVENT_TABLE()
243 DECLARE_WIDGETS_PAGE(TextWidgetsPage
)
246 // ----------------------------------------------------------------------------
248 // ----------------------------------------------------------------------------
250 class WidgetsTextCtrl
: public wxTextCtrl
253 WidgetsTextCtrl(wxWindow
*parent
,
255 const wxString
& value
,
257 : wxTextCtrl(parent
, id
, value
, wxDefaultPosition
, wxDefaultSize
, flags
)
262 void OnRightClick(wxMouseEvent
& event
)
266 switch ( HitTest(event
.GetPosition(), &x
, &y
) )
269 wxFAIL_MSG( wxT("unexpected HitTest() result") );
272 case wxTE_HT_UNKNOWN
:
274 where
= wxT("nowhere near");
278 where
= wxT("before");
282 where
= wxT("below");
286 where
= wxT("beyond");
289 case wxTE_HT_ON_TEXT
:
294 wxLogMessage(wxT("Mouse is %s (%ld, %ld)"), where
.c_str(), x
, y
);
300 DECLARE_EVENT_TABLE()
303 // ----------------------------------------------------------------------------
305 // ----------------------------------------------------------------------------
307 BEGIN_EVENT_TABLE(TextWidgetsPage
, WidgetsPage
)
308 EVT_IDLE(TextWidgetsPage::OnIdle
)
310 EVT_BUTTON(TextPage_Reset
, TextWidgetsPage::OnButtonReset
)
312 EVT_BUTTON(TextPage_StreamRedirector
, TextWidgetsPage::OnStreamRedirector
)
314 EVT_BUTTON(TextPage_Clear
, TextWidgetsPage::OnButtonClear
)
315 EVT_BUTTON(TextPage_Set
, TextWidgetsPage::OnButtonSet
)
316 EVT_BUTTON(TextPage_Add
, TextWidgetsPage::OnButtonAdd
)
317 EVT_BUTTON(TextPage_Insert
, TextWidgetsPage::OnButtonInsert
)
318 EVT_BUTTON(TextPage_Load
, TextWidgetsPage::OnButtonLoad
)
320 EVT_UPDATE_UI(TextPage_Clear
, TextWidgetsPage::OnUpdateUIClearButton
)
322 EVT_UPDATE_UI(TextPage_Password
, TextWidgetsPage::OnUpdateUIPasswordCheckbox
)
323 EVT_UPDATE_UI(TextPage_WrapLines
, TextWidgetsPage::OnUpdateUIWrapLinesCheckbox
)
325 EVT_UPDATE_UI(TextPage_Reset
, TextWidgetsPage::OnUpdateUIResetButton
)
327 EVT_TEXT(TextPage_Textctrl
, TextWidgetsPage::OnText
)
328 EVT_TEXT_ENTER(TextPage_Textctrl
, TextWidgetsPage::OnTextEnter
)
329 EVT_TEXT_PASTE(TextPage_Textctrl
, TextWidgetsPage::OnTextPasted
)
331 EVT_CHECKBOX(wxID_ANY
, TextWidgetsPage::OnCheckOrRadioBox
)
332 EVT_RADIOBOX(wxID_ANY
, TextWidgetsPage::OnCheckOrRadioBox
)
335 BEGIN_EVENT_TABLE(WidgetsTextCtrl
, wxTextCtrl
)
336 EVT_RIGHT_UP(WidgetsTextCtrl::OnRightClick
)
339 // ============================================================================
341 // ============================================================================
343 #if defined(__WXX11__)
344 #define FAMILY_CTRLS NATIVE_CTRLS
345 #elif defined(__WXUNIVERSAL__)
346 #define FAMILY_CTRLS UNIVERSAL_CTRLS
348 #define FAMILY_CTRLS NATIVE_CTRLS
351 IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage
, wxT("Text"),
352 FAMILY_CTRLS
| EDITABLE_CTRLS
355 // ----------------------------------------------------------------------------
356 // TextWidgetsPage creation
357 // ----------------------------------------------------------------------------
359 TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl
*book
, wxImageList
*imaglist
)
360 : WidgetsPage(book
, imaglist
, text_xpm
)
367 m_radioTextLines
= (wxRadioBox
*)NULL
;
372 m_chkFilename
= (wxCheckBox
*)NULL
;
382 m_textRange
= (wxTextCtrl
*)NULL
;
384 m_sizerText
= (wxSizer
*)NULL
;
389 m_selTo
= -2; // not -1 which means "no selection"
392 void TextWidgetsPage::CreateContent()
395 static const wxString modes
[] =
401 wxStaticBox
*box
= new wxStaticBox(this, wxID_ANY
, wxT("&Set textctrl parameters"));
402 m_radioTextLines
= new wxRadioBox(this, wxID_ANY
, wxT("&Number of lines:"),
403 wxDefaultPosition
, wxDefaultSize
,
404 WXSIZEOF(modes
), modes
,
405 1, wxRA_SPECIFY_COLS
);
407 wxSizer
*sizerLeft
= new wxStaticBoxSizer(box
, wxVERTICAL
);
409 sizerLeft
->Add(m_radioTextLines
, 0, wxGROW
| wxALL
, 5);
410 sizerLeft
->AddSpacer(5);
412 m_chkPassword
= CreateCheckBoxAndAddToSizer(
413 sizerLeft
, wxT("&Password control"), TextPage_Password
415 m_chkReadonly
= CreateCheckBoxAndAddToSizer(
416 sizerLeft
, wxT("&Read-only mode")
418 m_chkProcessEnter
= CreateCheckBoxAndAddToSizer(
419 sizerLeft
, wxT("Process &Enter")
421 m_chkFilename
= CreateCheckBoxAndAddToSizer(
422 sizerLeft
, wxT("&Filename control")
424 m_chkFilename
->Disable(); // not implemented yet
425 sizerLeft
->AddSpacer(5);
427 static const wxString wrap
[] =
435 m_radioWrap
= new wxRadioBox(this, wxID_ANY
, wxT("&Wrap style:"),
436 wxDefaultPosition
, wxDefaultSize
,
437 WXSIZEOF(wrap
), wrap
,
438 1, wxRA_SPECIFY_COLS
);
439 sizerLeft
->Add(m_radioWrap
, 0, wxGROW
| wxALL
, 5);
442 static const wxString kinds
[] =
446 wxT("rich edit 2.0"),
449 m_radioKind
= new wxRadioBox(this, wxID_ANY
, wxT("Control &kind"),
450 wxDefaultPosition
, wxDefaultSize
,
451 WXSIZEOF(kinds
), kinds
,
452 1, wxRA_SPECIFY_COLS
);
454 sizerLeft
->AddSpacer(5);
455 sizerLeft
->Add(m_radioKind
, 0, wxGROW
| wxALL
, 5);
458 wxButton
*btn
= new wxButton(this, TextPage_Reset
, wxT("&Reset"));
459 sizerLeft
->Add(2, 2, 0, wxGROW
| wxALL
, 1); // spacer
460 sizerLeft
->Add(btn
, 0, wxALIGN_CENTRE_HORIZONTAL
| wxALL
, 15);
463 wxStaticBox
*box2
= new wxStaticBox(this, wxID_ANY
, wxT("&Change contents:"));
464 wxSizer
*sizerMiddleUp
= new wxStaticBoxSizer(box2
, wxVERTICAL
);
466 btn
= new wxButton(this, TextPage_Set
, wxT("&Set text value"));
467 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
469 btn
= new wxButton(this, TextPage_Add
, wxT("&Append text"));
470 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
472 btn
= new wxButton(this, TextPage_Insert
, wxT("&Insert text"));
473 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
475 btn
= new wxButton(this, TextPage_Load
, wxT("&Load file"));
476 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
478 btn
= new wxButton(this, TextPage_Clear
, wxT("&Clear"));
479 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
481 btn
= new wxButton(this, TextPage_StreamRedirector
, wxT("St&ream redirection"));
482 sizerMiddleUp
->Add(btn
, 0, wxALL
| wxGROW
, 1);
484 wxStaticBox
*box4
= new wxStaticBox(this, wxID_ANY
, wxT("&Info:"));
485 wxSizer
*sizerMiddleDown
= new wxStaticBoxSizer(box4
, wxVERTICAL
);
487 m_textPosCur
= CreateInfoText();
488 m_textRowCur
= CreateInfoText();
489 m_textColCur
= CreateInfoText();
491 wxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
492 sizerRow
->Add(CreateTextWithLabelSizer
498 sizerRow
->Add(CreateTextWithLabelSizer
503 0, wxLEFT
| wxRIGHT
, 5);
504 sizerRow
->Add(CreateTextWithLabelSizer
510 sizerMiddleDown
->Add(sizerRow
, 0, wxALL
, 5);
512 m_textLineLast
= CreateInfoText();
513 m_textPosLast
= CreateInfoText();
516 CreateTextWithLabelSizer
518 wxT("Number of lines:"),
520 wxT("Last position:"),
526 m_textSelFrom
= CreateInfoText();
527 m_textSelTo
= CreateInfoText();
530 CreateTextWithLabelSizer
532 wxT("Selection: from"),
540 m_textRange
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
541 wxDefaultPosition
, wxDefaultSize
,
545 CreateTextWithLabelSizer
547 wxT("Range 10..20:"),
553 wxSizer
*sizerMiddle
= new wxBoxSizer(wxVERTICAL
);
554 sizerMiddle
->Add(sizerMiddleUp
, 0, wxGROW
);
555 sizerMiddle
->Add(sizerMiddleDown
, 1, wxGROW
| wxTOP
, 5);
558 wxStaticBox
*box3
= new wxStaticBox(this, wxID_ANY
, wxT("&Text:"));
559 m_sizerText
= new wxStaticBoxSizer(box3
, wxHORIZONTAL
);
562 m_sizerText
->SetMinSize(150, 0);
564 // the 3 panes panes compose the upper part of the window
565 wxSizer
*sizerTop
= new wxBoxSizer(wxHORIZONTAL
);
566 sizerTop
->Add(sizerLeft
, 0, wxGROW
| (wxALL
& ~wxLEFT
), 10);
567 sizerTop
->Add(sizerMiddle
, 0, wxGROW
| wxALL
, 10);
568 sizerTop
->Add(m_sizerText
, 1, wxGROW
| (wxALL
& ~wxRIGHT
), 10);
573 // ----------------------------------------------------------------------------
575 // ----------------------------------------------------------------------------
577 wxTextCtrl
*TextWidgetsPage::CreateInfoText()
579 static int s_maxWidth
= 0;
583 GetTextExtent(wxT("9999999"), &s_maxWidth
, NULL
);
586 wxTextCtrl
*text
= new wxTextCtrl(this, wxID_ANY
, wxEmptyString
,
588 wxSize(s_maxWidth
, wxDefaultCoord
),
593 wxSizer
*TextWidgetsPage::CreateTextWithLabelSizer(const wxString
& label
,
595 const wxString
& label2
,
598 wxSizer
*sizerRow
= new wxBoxSizer(wxHORIZONTAL
);
599 sizerRow
->Add(new wxStaticText(this, wxID_ANY
, label
), 0,
600 wxALIGN_CENTRE_VERTICAL
| wxRIGHT
, 5);
601 sizerRow
->Add(text
, 0, wxALIGN_CENTRE_VERTICAL
);
604 sizerRow
->Add(new wxStaticText(this, wxID_ANY
, label2
), 0,
605 wxALIGN_CENTRE_VERTICAL
| wxLEFT
| wxRIGHT
, 5);
606 sizerRow
->Add(text2
, 0, wxALIGN_CENTRE_VERTICAL
);
612 // ----------------------------------------------------------------------------
614 // ----------------------------------------------------------------------------
616 void TextWidgetsPage::Reset()
618 m_radioTextLines
->SetSelection(DEFAULTS
.textLines
);
620 m_chkPassword
->SetValue(DEFAULTS
.password
);
621 m_chkReadonly
->SetValue(DEFAULTS
.readonly
);
622 m_chkProcessEnter
->SetValue(DEFAULTS
.processEnter
);
623 m_chkFilename
->SetValue(DEFAULTS
.filename
);
625 m_radioWrap
->SetSelection(DEFAULTS
.wrapStyle
);
628 m_radioKind
->SetSelection(DEFAULTS
.textKind
);
632 void TextWidgetsPage::CreateText()
634 int flags
= ms_defaultFlags
;
635 switch ( m_radioTextLines
->GetSelection() )
638 wxFAIL_MSG( wxT("unexpected lines radio box selection") );
640 case TextLines_Single
:
643 case TextLines_Multi
:
644 flags
|= wxTE_MULTILINE
;
645 m_chkPassword
->SetValue(false);
649 if ( m_chkPassword
->GetValue() )
650 flags
|= wxTE_PASSWORD
;
651 if ( m_chkReadonly
->GetValue() )
652 flags
|= wxTE_READONLY
;
653 if ( m_chkProcessEnter
->GetValue() )
654 flags
|= wxTE_PROCESS_ENTER
;
656 switch ( m_radioWrap
->GetSelection() )
659 wxFAIL_MSG( wxT("unexpected wrap style radio box selection") );
662 flags
|= wxTE_DONTWRAP
; // same as wxHSCROLL
666 flags
|= wxTE_WORDWRAP
;
670 flags
|= wxTE_CHARWRAP
;
674 // this is default but use symbolic file name for consistency
675 flags
|= wxTE_BESTWRAP
;
680 switch ( m_radioKind
->GetSelection() )
683 wxFAIL_MSG( wxT("unexpected kind radio box selection") );
701 valueOld
= m_text
->GetValue();
703 m_sizerText
->Detach( m_text
);
708 valueOld
= wxT("Hello, Universe!");
711 m_text
= new WidgetsTextCtrl(this, TextPage_Textctrl
, valueOld
, flags
);
714 if ( m_chkFilename
->GetValue() )
718 // cast to int needed to silence gcc warning about different enums
719 m_sizerText
->Add(m_text
, 1, wxALL
|
720 (flags
& wxTE_MULTILINE
? (int)wxGROW
722 m_sizerText
->Layout();
725 // ----------------------------------------------------------------------------
727 // ----------------------------------------------------------------------------
729 void TextWidgetsPage::OnIdle(wxIdleEvent
& WXUNUSED(event
))
731 // update all info texts
735 long posCur
= m_text
->GetInsertionPoint();
736 if ( posCur
!= m_posCur
)
738 m_textPosCur
->Clear();
739 m_textRowCur
->Clear();
740 m_textColCur
->Clear();
743 m_text
->PositionToXY(posCur
, &col
, &row
);
745 *m_textPosCur
<< posCur
;
746 *m_textRowCur
<< row
;
747 *m_textColCur
<< col
;
755 long posLast
= m_text
->GetLastPosition();
756 if ( posLast
!= m_posLast
)
758 m_textPosLast
->Clear();
759 *m_textPosLast
<< posLast
;
765 if ( m_textLineLast
)
767 m_textLineLast
->SetValue(
768 wxString::Format(wxT("%d"), m_text
->GetNumberOfLines()) );
771 if ( m_textSelFrom
&& m_textSelTo
)
774 m_text
->GetSelection(&selFrom
, &selTo
);
775 if ( selFrom
!= m_selFrom
)
777 m_textSelFrom
->Clear();
778 *m_textSelFrom
<< selFrom
;
783 if ( selTo
!= m_selTo
)
785 m_textSelTo
->Clear();
786 *m_textSelTo
<< selTo
;
794 wxString range
= m_text
->GetRange(10, 20);
795 if ( range
!= m_range10_20
)
797 m_range10_20
= range
;
798 m_textRange
->SetValue(range
);
803 void TextWidgetsPage::OnButtonReset(wxCommandEvent
& WXUNUSED(event
))
810 void TextWidgetsPage::OnButtonSet(wxCommandEvent
& WXUNUSED(event
))
812 m_text
->SetValue(m_text
->GetWindowStyle() & wxTE_MULTILINE
813 ? wxT("Here,\nthere and\neverywhere")
814 : wxT("Yellow submarine"));
819 void TextWidgetsPage::OnButtonAdd(wxCommandEvent
& WXUNUSED(event
))
821 if ( m_text
->GetWindowStyle() & wxTE_MULTILINE
)
823 m_text
->AppendText(wxT("We all live in a\n"));
826 m_text
->AppendText(wxT("Yellow submarine"));
829 void TextWidgetsPage::OnButtonInsert(wxCommandEvent
& WXUNUSED(event
))
831 m_text
->WriteText(wxT("Is there anybody going to listen to my story"));
832 if ( m_text
->GetWindowStyle() & wxTE_MULTILINE
)
834 m_text
->WriteText(wxT("\nall about the girl who came to stay"));
838 void TextWidgetsPage::OnButtonClear(wxCommandEvent
& WXUNUSED(event
))
844 void TextWidgetsPage::OnButtonLoad(wxCommandEvent
& WXUNUSED(event
))
846 // search for the file in several dirs where it's likely to be
848 pathlist
.Add(wxT("."));
849 pathlist
.Add(wxT(".."));
850 pathlist
.Add(wxT("../../../samples/widgets"));
852 wxString filename
= pathlist
.FindValidPath(wxT("textctrl.cpp"));
855 wxLogError(wxT("File textctrl.cpp not found."));
860 if ( !m_text
->LoadFile(filename
) )
862 // this is not supposed to happen ...
863 wxLogError(wxT("Error loading file."));
867 long elapsed
= sw
.Time();
868 wxLogMessage(wxT("Loaded file '%s' in %lu.%us"),
869 filename
.c_str(), elapsed
/ 1000,
870 (unsigned int) elapsed
% 1000);
875 void TextWidgetsPage::OnUpdateUIClearButton(wxUpdateUIEvent
& event
)
877 event
.Enable(!m_text
->GetValue().empty());
880 void TextWidgetsPage::OnUpdateUIWrapLinesCheckbox(wxUpdateUIEvent
& event
)
882 event
.Enable( !IsSingleLine() );
885 void TextWidgetsPage::OnUpdateUIPasswordCheckbox(wxUpdateUIEvent
& event
)
887 // can't put multiline control in password mode
888 event
.Enable( IsSingleLine() );
891 void TextWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent
& event
)
893 event
.Enable( (m_radioTextLines
->GetSelection() != DEFAULTS
.textLines
) ||
895 (m_radioKind
->GetSelection() != DEFAULTS
.textKind
) ||
897 (m_chkPassword
->GetValue() != DEFAULTS
.password
) ||
898 (m_chkReadonly
->GetValue() != DEFAULTS
.readonly
) ||
899 (m_chkProcessEnter
->GetValue() != DEFAULTS
.processEnter
) ||
900 (m_chkFilename
->GetValue() != DEFAULTS
.filename
) ||
901 (m_radioWrap
->GetSelection() != DEFAULTS
.wrapStyle
) );
904 void TextWidgetsPage::OnText(wxCommandEvent
& WXUNUSED(event
))
906 // small hack to suppress the very first message: by then the logging is
907 // not yet redirected and so initial setting of the text value results in
908 // an annoying message box
909 static bool s_firstTime
= true;
916 wxLogMessage(wxT("Text ctrl value changed"));
919 void TextWidgetsPage::OnTextEnter(wxCommandEvent
& event
)
921 wxLogMessage(wxT("Text entered: '%s'"), event
.GetString().c_str());
925 void TextWidgetsPage::OnTextPasted(wxClipboardTextEvent
& event
)
927 wxLogMessage("Text pasted from clipboard.");
931 void TextWidgetsPage::OnCheckOrRadioBox(wxCommandEvent
& WXUNUSED(event
))
936 void TextWidgetsPage::OnStreamRedirector(wxCommandEvent
& WXUNUSED(event
))
938 #if wxHAS_TEXT_WINDOW_STREAM
939 wxStreamToTextRedirector
redirect(m_text
);
940 wxString
str( wxT("Outputed to cout, appears in wxTextCtrl!") );
941 wxSTD cout
<< str
<< wxSTD endl
;
943 wxMessageBox(wxT("This wxWidgets build does not support wxStreamToTextRedirector"));