A bit more testing.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4343 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,12 +57,14 @@ class MyTextCtrl : public wxTextCtrl
|
||||
public:
|
||||
MyTextCtrl(wxWindow *parent, wxWindowID id, const wxString &value,
|
||||
const wxPoint &pos, const wxSize &size, int style = 0)
|
||||
: wxTextCtrl(parent, id, value, pos, size, style) { }
|
||||
: wxTextCtrl(parent, id, value, pos, size, style) { m_hasCapture = FALSE; }
|
||||
|
||||
void OnKeyDown(wxKeyEvent& event);
|
||||
void OnKeyUp(wxKeyEvent& event);
|
||||
void OnChar(wxKeyEvent& event);
|
||||
|
||||
bool m_hasCapture;
|
||||
|
||||
private:
|
||||
static inline wxChar GetChar(bool on, wxChar c) { return on ? c : _T('-'); }
|
||||
void LogEvent(const wxChar *name, wxKeyEvent& event) const;
|
||||
@@ -411,6 +413,21 @@ void MyTextCtrl::OnKeyDown(wxKeyEvent& event)
|
||||
// go to position 10
|
||||
SetInsertionPoint(10);
|
||||
break;
|
||||
|
||||
case WXK_F4:
|
||||
if (!m_hasCapture)
|
||||
{
|
||||
wxLogDebug( wxT("Now capturing mouse and events.") );
|
||||
m_hasCapture = TRUE;
|
||||
CaptureMouse();
|
||||
}
|
||||
else
|
||||
{
|
||||
wxLogDebug( wxT("Stopped capturing mouse and events.") );
|
||||
m_hasCapture = TRUE;
|
||||
ReleaseMouse();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
LogEvent( _("Key down"), event);
|
||||
@@ -463,7 +480,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h )
|
||||
m_multitext->WriteText( "Prepended. " );
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
m_multitext->SetToolTip("Press F1 here.");
|
||||
m_multitext->SetToolTip("Press F1 here for statitics, F4 for capture and uncapture mouse.");
|
||||
#endif
|
||||
|
||||
m_tab = new MyTextCtrl( this, -1, "Multiline, allow <TAB> processing.",
|
||||
|
@@ -209,10 +209,10 @@ bool MyApp::InitToolbar(wxToolBar* toolBar, bool smallicons)
|
||||
if ( !smallicons )
|
||||
{
|
||||
currentX += width + 5;
|
||||
toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Save file");
|
||||
toolBar->AddTool(wxID_SAVE, *(toolBarBitmaps[2]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 1");
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Disable/Enable print button");
|
||||
toolBar->AddTool(wxID_COPY, *(toolBarBitmaps[3]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Toggle button 2");
|
||||
currentX += width + 5;
|
||||
toolBar->AddTool(wxID_CUT, *(toolBarBitmaps[4]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Toggle/Untoggle help button");
|
||||
currentX += width + 5;
|
||||
@@ -222,8 +222,11 @@ bool MyApp::InitToolbar(wxToolBar* toolBar, bool smallicons)
|
||||
toolBar->AddTool(wxID_PRINT, *(toolBarBitmaps[6]), wxNullBitmap, FALSE, currentX, -1, (wxObject *) NULL, "Print");
|
||||
currentX += width + 5;
|
||||
toolBar->AddSeparator();
|
||||
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), *(toolBarBitmaps[6]), TRUE, currentX, -1, (wxObject *) NULL, "Help");
|
||||
toolBar->AddTool(wxID_HELP, *(toolBarBitmaps[7]), wxNullBitmap, TRUE, currentX, -1, (wxObject *) NULL, "Help button");
|
||||
|
||||
toolBar->ToggleTool( wxID_SAVE, TRUE );
|
||||
toolBar->ToggleTool( wxID_COPY, TRUE );
|
||||
toolBar->ToggleTool( wxID_COPY, FALSE );
|
||||
toolBar->EnableTool( wxID_PRINT, FALSE );
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user