From 42b53f156d768a6e8e817a0f8127eba07524a3a5 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 21 May 2016 23:04:13 +0200 Subject: [PATCH] Show the time taken by the simulation in the uiaction sample If nothing else, it allows it to see when the simulation is done. --- samples/uiaction/uiaction.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/samples/uiaction/uiaction.cpp b/samples/uiaction/uiaction.cpp index 87fcf2f575..fd5567c1bd 100644 --- a/samples/uiaction/uiaction.cpp +++ b/samples/uiaction/uiaction.cpp @@ -33,6 +33,8 @@ #include "wx/uiaction.h" #endif +#include "wx/stopwatch.h" + // ---------------------------------------------------------------------------- // resources // ---------------------------------------------------------------------------- @@ -172,6 +174,10 @@ MyFrame::MyFrame(const wxString& title) void MyFrame::OnRunSimulation(wxCommandEvent& WXUNUSED(event)) { + m_text->SetValue("=== Starting the simulation ===\n"); + + wxStopWatch sw; + wxUIActionSimulator sim; // Add some extra distance to take account of window decorations @@ -193,6 +199,10 @@ void MyFrame::OnRunSimulation(wxCommandEvent& WXUNUSED(event)) sim.Text("1 234.57e-8"); sim.Char(WXK_RETURN); + // Process the resulting text events + wxYield(); + + m_text->AppendText(wxString::Format("\n=== Done in %ldms ===\n", sw.Time())); } void MyFrame::OnSimulateText(wxCommandEvent& WXUNUSED(event))