cd treectrl
md \wxmsw_dist\wxMSW\samples\treectrl
copy Makefile.* \wxmsw_dist\wxMSW\samples\treectrl
-copy *.rc \wxmsw_dist\wxMSW\samples\toolbar
-copy *.def \wxmsw_dist\wxMSW\samples\toolbar
+copy *.rc \wxmsw_dist\wxMSW\samples\treectrl
+copy *.def \wxmsw_dist\wxMSW\samples\treectrl
copy *.cpp \wxmsw_dist\wxMSW\samples\treectrl
copy *.h \wxmsw_dist\wxMSW\samples\treectrl
copy *.xpm \wxmsw_dist\wxMSW\samples\treectrl
copy *.ico \wxmsw_dist\wxMSW\samples\treectrl
-cd ..
+cd bitmaps
+md \wxmsw_dist\wxMSW\samples\treectrl\bitmaps
+copy *.* \wxmsw_dist\wxMSW\samples\treectrl\bitmaps
+cd ..\..
echo typetest sample..
void DoMoveToEndOfText();
void DoMoveToEndOfEntry();
+ void OnSize( wxSizeEvent &event );
+
MyTextCtrl *m_text;
MyTextCtrl *m_password;
MyTextCtrl *m_enter;
MyTextCtrl *m_horizontal;
wxTextCtrl *m_log;
+
+private:
+ DECLARE_EVENT_TABLE()
};
class MyFrame: public wxFrame
// Create the main frame window
MyFrame *frame = new MyFrame((wxFrame *) NULL,
"Text wxWindows App",
- 50, 50, 640, 420);
+ 50, 50, 640, 420);
+ frame->SetSizeHints( 500, 400 );
wxMenu *file_menu = new wxMenu;
file_menu->Append(TEXT_LOAD, "&Load file\tCtrl-O",
{
wxString key;
long keycode = event.KeyCode();
- if ( wxIsprint((int)keycode) )
- key.Printf( _T("'%c'") , (char)keycode);
- else
{
switch ( keycode )
{
case WXK_NUMPAD_SUBTRACT: key = "NUMPAD_SUBTRACT"; break;
case WXK_NUMPAD_DECIMAL: key = "NUMPAD_DECIMAL"; break;
- default:
- key.Printf( _T("unknown (%ld)"), keycode);
+ default:
+ {
+ if ( wxIsprint((int)keycode) )
+ key.Printf( _T("'%c'") , (char)keycode);
+ else
+ key.Printf( _T("unknown (%ld)"), keycode);
+ }
}
}
// MyPanel
//----------------------------------------------------------------------
+BEGIN_EVENT_TABLE(MyPanel, wxPanel)
+ EVT_SIZE(MyPanel::OnSize)
+END_EVENT_TABLE()
+
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
: wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) )
{
m_log = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(5,260), wxSize(630,100), wxTE_MULTILINE );
- delete wxLog::SetActiveTarget(new wxLogStderr);
+ wxLog *old_log = wxLog::SetActiveTarget( new wxLogTextCtrl( m_log ) );
+
+ delete old_log;
// single line text controls
wxPoint(180,170), wxSize(240,70), wxTE_MULTILINE);
}
+void MyPanel::OnSize( wxSizeEvent &event )
+{
+ wxSize client_area( GetClientSize() );
+ m_log->SetSize( 0, 260, client_area.x, client_area.y - 260 );
+ event.Skip();
+}
+
#if wxUSE_CLIPBOARD
void MyPanel::DoPasteFromClipboard()
{
void MyFrame::OnFileLoad(wxCommandEvent& event)
{
- if ( m_panel->m_multitext->LoadFile("controls.cpp") )
+ if ( m_panel->m_multitext->LoadFile("text.cpp") )
wxLogStatus(this, _T("Successfully loaded file"));
else
wxLogStatus(this, _T("Couldn't load the file"));
#include "math.h"
-#ifdef __WXMSW__
- //#define NO_MULTIPLE_SELECTION
+//#ifdef __WXMSW__
+ #define NO_MULTIPLE_SELECTION
#define NO_VARIABLE_HEIGHT
-#endif
+//#endif
#include "treetest.h"
wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS |
wxTR_EDIT_LABELS |
- wxTR_MULTIPLE |
- wxTR_HAS_VARIABLE_ROW_HEIGHT |
- wxSUNKEN_BORDER);
+#ifndef NO_MULTIPLE_SELECTION
+ wxTR_MULTIPLE |
+#endif
+#ifndef NO_VARIABLE_HEIGHT
+ wxTR_HAS_VARIABLE_ROW_HEIGHT |
+#endif
+ wxSUNKEN_BORDER);
wxTextCtrl *textCtrl = new wxTextCtrl(this, -1, "",
wxDefaultPosition, wxDefaultSize,
wxTE_MULTILINE | wxSUNKEN_BORDER);