//----------------------------------------------------------------------
// class definitions
//----------------------------------------------------------------------
//----------------------------------------------------------------------
// class definitions
//----------------------------------------------------------------------
void OnAddTextFreeze( wxCommandEvent& WXUNUSED(event) )
{ DoAddText(true); }
void OnAddText( wxCommandEvent& WXUNUSED(event) )
void OnAddTextFreeze( wxCommandEvent& WXUNUSED(event) )
{ DoAddText(true); }
void OnAddText( wxCommandEvent& WXUNUSED(event) )
- m_panel->m_text->SetValue(_T("Hello, world (what else did you expect)?"));
+ m_panel->m_text->SetValue(_T("Hello, world! (what else did you expect?)"));
+ }
+
+ void OnChangeText(wxCommandEvent& WXUNUSED(event))
+ {
+ m_panel->m_text->ChangeValue(_T("Changed, not set: no event"));
for ( int i = 0; i < 100; i++ )
{
text->AppendText(wxString::Format(wxT("Line %i\n"), i));
}
for ( int i = 0; i < 100; i++ )
{
text->AppendText(wxString::Format(wxT("Line %i\n"), i));
}
// Create the main frame window
MyFrame *frame = new MyFrame((wxFrame *) NULL,
_T("Text wxWidgets sample"), 50, 50, 700, 550);
// Create the main frame window
MyFrame *frame = new MyFrame((wxFrame *) NULL,
_T("Text wxWidgets sample"), 50, 50, 700, 550);
wxMenu *menuText = new wxMenu;
menuText->Append(TEXT_ADD_SOME, _T("&Append some text\tCtrl-A"));
menuText->Append(TEXT_ADD_FREEZE, _T("&Append text with freeze/thaw\tShift-Ctrl-A"));
wxMenu *menuText = new wxMenu;
menuText->Append(TEXT_ADD_SOME, _T("&Append some text\tCtrl-A"));
menuText->Append(TEXT_ADD_FREEZE, _T("&Append text with freeze/thaw\tShift-Ctrl-A"));
menuText->Append(TEXT_REMOVE, _T("&Remove first 10 characters\tCtrl-Y"));
menuText->Append(TEXT_REPLACE, _T("&Replace characters 4 to 8 with ABC\tCtrl-R"));
menuText->Append(TEXT_SELECT, _T("&Select characters 4 to 8\tCtrl-I"));
menuText->Append(TEXT_SET, _T("&Set the first text zone value\tCtrl-E"));
menuText->Append(TEXT_REMOVE, _T("&Remove first 10 characters\tCtrl-Y"));
menuText->Append(TEXT_REPLACE, _T("&Replace characters 4 to 8 with ABC\tCtrl-R"));
menuText->Append(TEXT_SELECT, _T("&Select characters 4 to 8\tCtrl-I"));
menuText->Append(TEXT_SET, _T("&Set the first text zone value\tCtrl-E"));
menuText->AppendSeparator();
menuText->Append(TEXT_MOVE_ENDTEXT, _T("Move cursor to the end of &text"));
menuText->Append(TEXT_MOVE_ENDENTRY, _T("Move cursor to the end of &entry"));
menuText->AppendSeparator();
menuText->Append(TEXT_MOVE_ENDTEXT, _T("Move cursor to the end of &text"));
menuText->Append(TEXT_MOVE_ENDENTRY, _T("Move cursor to the end of &entry"));
wxLogMessage(_T("Selection = '%s' (len = %u)"),
sel.c_str(),
(unsigned int) sel.length());
wxLogMessage(_T("Selection = '%s' (len = %u)"),
sel.c_str(),
(unsigned int) sel.length());
{
case '2':
m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL,
{
case '2':
m_horizontal->SetFont(wxFont(18, wxSWISS, wxNORMAL, wxNORMAL,
- m_multitext = new MyTextCtrl( this, wxID_ANY, _T("Multi line."),
- wxPoint(180,10), wxSize(200,70), wxTE_MULTILINE );
+ m_multitext = new MyTextCtrl( this, wxID_ANY,
+ _T("Multi line without vertical scrollbar."),
+ wxPoint(180,10), wxSize(200,70), wxTE_MULTILINE | wxTE_NO_VSCROLL );
m_multitext->SetFont(*wxITALIC_FONT);
(*m_multitext) << _T(" Appended.");
m_multitext->SetInsertionPoint(0);
m_multitext->WriteText( _T("Prepended. ") );
m_multitext->SetFont(*wxITALIC_FONT);
(*m_multitext) << _T(" Appended.");
m_multitext->SetInsertionPoint(0);
m_multitext->WriteText( _T("Prepended. ") );
topSizer->Add( m_log, 1, wxALL | wxEXPAND, 10 );
#endif
topSizer->Add( m_log, 1, wxALL | wxEXPAND, 10 );
#endif
EVT_MENU(TEXT_SELECT, MyFrame::OnSelectText)
EVT_MENU(TEXT_ADD_SOME, MyFrame::OnAddText)
EVT_MENU(TEXT_ADD_FREEZE, MyFrame::OnAddTextFreeze)
EVT_MENU(TEXT_SELECT, MyFrame::OnSelectText)
EVT_MENU(TEXT_ADD_SOME, MyFrame::OnAddText)
EVT_MENU(TEXT_ADD_FREEZE, MyFrame::OnAddTextFreeze)
EVT_MENU(TEXT_MOVE_ENDTEXT, MyFrame::OnMoveToEndOfText)
EVT_MENU(TEXT_MOVE_ENDENTRY, MyFrame::OnMoveToEndOfEntry)
EVT_MENU(TEXT_MOVE_ENDTEXT, MyFrame::OnMoveToEndOfText)
EVT_MENU(TEXT_MOVE_ENDENTRY, MyFrame::OnMoveToEndOfEntry)
EVT_MENU(TEXT_PAGE_DOWN, MyFrame::OnScrollPageDown)
EVT_MENU(TEXT_PAGE_UP, MyFrame::OnScrollPageUp)
EVT_MENU(TEXT_PAGE_DOWN, MyFrame::OnScrollPageDown)
EVT_MENU(TEXT_PAGE_UP, MyFrame::OnScrollPageUp)
- EVT_MENU(TEXT_GET_LINE, MyFrame::OnGetLine)
- EVT_MENU(TEXT_GET_LINELENGTH, MyFrame::OnGetLineLength)
+ EVT_MENU(TEXT_GET_LINE, MyFrame::OnGetLine)
+ EVT_MENU(TEXT_GET_LINELENGTH, MyFrame::OnGetLineLength)
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
{
MyFrame::MyFrame(wxFrame *frame, const wxChar *title, int x, int y, int w, int h)
: wxFrame(frame, wxID_ANY, title, wxPoint(x, y), wxSize(w, h) )
{
alignment = wxT("left-aligned");
else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
alignment = wxT("justified");
alignment = wxT("left-aligned");
else if (attr.GetAlignment() == wxTEXT_ALIGNMENT_JUSTIFIED)
alignment = wxT("justified");
- msg.Printf(wxT("Facename: %s, wxColour(%d, %d, %d), %s"),
- (const wxChar*) facename,
+ msg.Printf( "Facename: %s, wxColour(%d, %d, %d), %s", facename,
attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(),
attr.GetTextColour().Red(), attr.GetTextColour().Green(), attr.GetTextColour().Blue(),