From dd2f7c31716029171706ff70b56eb66fd082e296 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Br=C3=BCns?= Date: Sun, 31 May 2020 20:01:54 +0200 Subject: [PATCH 2/2] Make the wxUIActionSimulator::Text implementation match the interface interface/uiaction.h declares the parameter as 'const wxString&'. For non-STL variants, this just makes the char* conversion explicit, while for STL variants this actually allows to pass a wxString to the method. This also fixes a compile error when building wxPython with a system wxWidgets library which has been built with wxUSE_STL=1. --- include/wx/uiaction.h | 1 + src/common/uiactioncmn.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/wx/uiaction.h b/include/wx/uiaction.h index 9b8df1094f..c8d01f52df 100644 --- a/include/wx/uiaction.h +++ b/include/wx/uiaction.h @@ -60,6 +60,7 @@ public: bool Char(int keycode, int modifiers = wxMOD_NONE); bool Text(const char *text); + bool Text(const wxString& text); // Select the item with the given text in the currently focused control. bool Select(const wxString& text); diff --git a/src/common/uiactioncmn.cpp b/src/common/uiactioncmn.cpp index eeaf01ef93..092825681f 100644 --- a/src/common/uiactioncmn.cpp +++ b/src/common/uiactioncmn.cpp @@ -163,6 +163,12 @@ static bool MapUnshifted(char& ch) return true; } +bool wxUIActionSimulator::Text(const wxString& text) +{ + const wxScopedCharBuffer ascii = text.ToAscii(); + return Text(ascii.data()); +} + bool wxUIActionSimulator::Text(const char *s) { while ( *s != '\0' ) -- 2.26.2