How to create Wx::KeyEvent objects and set KeyCode?

Ian Macdonald <[email protected]> Tue, 23 Aug 2016 02:13:02 +0000
Newsgroups gmane.comp.lang.perl.wxperl
Message-ID <73F0C3F8C43DBF48946AEC0F73B58B287AFC34B5@VICARMEXDB01.lfxau.linfox.com>
--_000_73F0C3F8C43DBF48946AEC0F73B58B287AFC34B5VICARMEXDB01lfx_
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

Hi,

In our application, we want all text fields to start in overwrite mode. I'v=
e been unable to find any reference to this feature anywhere in the wxWidge=
ts docs so am looking for workarounds (if I've missed something obvious her=
e, I'll be very grateful for the answer).

I'm looking at using EmulateKeyPress instead and just sending a WXK_INSERT =
event to every control on creation, which should/might flip the insert/over=
write mode. However, any examples I've seen have been in C++ or Python and =
access the KeyEvent internal variable thus:

evt.m_keyCode =3D WXK_INSERT;

There doesn't seem to be a way of either constructing a KeyEvent with a giv=
en code or setting it after construction; there's no SetKeyCode.

I've tried "evt->m_keyCode(WXK_INSERT)" and "evt->{m_keyCode}  =3D WXK_INSE=
RT" to no avail; any help out there?


Ian Macdonald
Melbourne, Australia

WARNING: This email and any attachments may be confidential, subject to cop=
yright and subject to legal professional privilege. If you have received th=
is email in error, please notify the sender and permanently delete the emai=
l. Linfox Australia Pty Ltd and its related companies do not warrant that t=
his email and any attachments are free of errors, viruses or tampering by t=
hird parties, and will not be responsible for loss or damage resulting (eit=
her directly or indirectly) from any such error, virus or tampering. Any pe=
rsonal information in this email must be handled in accordance with the Aus=
tralian Privacy Act 1988 (Cth) or privacy laws in the respective countries.=
 If this is a commercial email within the meaning of the Spam Act, you may =
inform us using contact details at www.linfox.com

--_000_73F0C3F8C43DBF48946AEC0F73B58B287AFC34B5VICARMEXDB01lfx_
Content-Type: text/html; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" xmlns:o=3D"urn:schemas-micr=
osoft-com:office:office" xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" xmlns=3D"http:=
//www.w3.org/TR/REC-html40">
<head>
<meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Dus-ascii"=
>
<meta name=3D"Generator" content=3D"Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang=3D"EN-AU" link=3D"blue" vlink=3D"purple">
<div class=3D"WordSection1">
<p class=3D"MsoNormal">Hi,<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">In our application, we want all text fields to start=
 in overwrite mode. I&#8217;ve been unable to find any reference to this fe=
ature anywhere in the wxWidgets docs so am looking for workarounds (if I&#8=
217;ve missed something obvious here, I&#8217;ll be
 very grateful for the answer).<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;m looking at using EmulateKeyPress instead a=
nd just sending a WXK_INSERT event to every control on creation, which shou=
ld/might flip the insert/overwrite mode. However, any examples I&#8217;ve s=
een have been in C&#43;&#43; or Python and access the
 KeyEvent internal variable thus:<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">evt.m_keyCode =3D WXK_INSERT;<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">There doesn&#8217;t seem to be a way of either const=
ructing a KeyEvent with a given code or setting it after construction; ther=
e&#8217;s no SetKeyCode.<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal">I&#8217;ve tried &#8220;evt-&gt;m_keyCode(WXK_INSERT=
)&#8221; and &#8220;evt-&gt;{m_keyCode} &nbsp;=3D WXK_INSERT&#8221; to no a=
vail; any help out there?<o:p></o:p></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
<p class=3D"MsoNormal"><b><span style=3D"mso-fareast-language:EN-AU"><o:p>&=
nbsp;</o:p></span></b></p>
<p class=3D"MsoNormal"><b><span style=3D"mso-fareast-language:EN-AU">Ian Ma=
cdonald<o:p></o:p></span></b></p>
<p class=3D"MsoNormal"><span style=3D"mso-fareast-language:EN-AU">Melbourne=
, Australia<o:p></o:p></span></p>
<p class=3D"MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
WARNING: This email and any attachments may be confidential, subject to cop=
yright and subject to legal professional privilege. If you have received th=
is email in error, please notify the sender and permanently delete the emai=
l. Linfox Australia Pty Ltd and
 its related companies do not warrant that this email and any attachments a=
re free of errors, viruses or tampering by third parties, and will not be r=
esponsible for loss or damage resulting (either directly or indirectly) fro=
m any such error, virus or tampering.
 Any personal information in this email must be handled in accordance with =
the Australian Privacy Act 1988 (Cth) or privacy laws in the respective cou=
ntries. If this is a commercial email within the meaning of the Spam Act, y=
ou may inform us using contact details
 at www.linfox.com
</body>
</html>

--_000_73F0C3F8C43DBF48946AEC0F73B58B287AFC34B5VICARMEXDB01lfx_--