X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/571d991bb3232f0dcd3319dbdc9d35e5c80f4c71..bdbdb4d18173951919a62187754af26665e8c677:/samples/uiaction/uiaction.cpp diff --git a/samples/uiaction/uiaction.cpp b/samples/uiaction/uiaction.cpp index 3b6d078587..6fd518e299 100644 --- a/samples/uiaction/uiaction.cpp +++ b/samples/uiaction/uiaction.cpp @@ -40,7 +40,7 @@ // the application icon (under Windows and OS/2 it is in resources and even // though we could still include the XPM here it would be unused) -#if !defined(__WXMSW__) && !defined(__WXPM__) +#ifndef wxHAS_IMAGES_IN_RESOURCES #include "../sample.xpm" #endif @@ -52,7 +52,8 @@ enum { // menu items - RunSimulation = 1 + RunSimulation = 1, + SimulateText }; // ---------------------------------------------------------------------------- @@ -77,6 +78,7 @@ public: void OnButtonPressed(wxCommandEvent& event); void OnRunSimulation(wxCommandEvent& event); + void OnSimulateText(wxCommandEvent& event); void OnExit(wxCommandEvent& WXUNUSED(event)) { Close(); } private: @@ -89,6 +91,7 @@ private: BEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_BUTTON(wxID_ANY, MyFrame::OnButtonPressed) EVT_MENU(RunSimulation, MyFrame::OnRunSimulation) + EVT_MENU(SimulateText, MyFrame::OnSimulateText) EVT_MENU(wxID_EXIT, MyFrame::OnExit) END_EVENT_TABLE() @@ -137,7 +140,11 @@ MyFrame::MyFrame(const wxString& title) wxMenu *fileMenu = new wxMenu; fileMenu->Append(wxID_NEW, "&New File...", "Open a new file"); - fileMenu->Append(RunSimulation, "&Run Simulation...", "Run the UI action simulation"); + fileMenu->Append(RunSimulation, "&Run Simulation", + "Run predefined UI action simulation"); + fileMenu->Append(SimulateText, "Simulate &text input...", + "Enter text to simulate"); + fileMenu->AppendSeparator(); fileMenu->Append(wxID_EXIT, "E&xit\tAlt-X", "Quit this program"); @@ -184,6 +191,29 @@ void MyFrame::OnRunSimulation(wxCommandEvent& WXUNUSED(event)) sim.Char(WXK_RETURN); sim.Text("aAbBcC"); sim.Char(WXK_RETURN); + sim.Text("1 234.57e-8"); + sim.Char(WXK_RETURN); + +} + +void MyFrame::OnSimulateText(wxCommandEvent& WXUNUSED(event)) +{ + static wxString s_text; + const wxString text = wxGetTextFromUser + ( + "Enter text to simulate: ", + "wxUIActionSimulator wxWidgets Sample", + s_text, + this + ); + if ( text.empty() ) + return; + + s_text = text; + + wxUIActionSimulator sim; + m_text->SetFocus(); + sim.Text(s_text.c_str()); } void MyFrame::OnButtonPressed(wxCommandEvent& WXUNUSED(event))