Is there any way to prevent wxTextCtrl to process key-events on MSW?
I have some code that works fine on Linux+wxPython (2.2.5), but not at
all in Win32 environment (+wxPython 2.2.5).
class MyTextCtrl(wx.wxTextCtrl):
def __init__(...):
wx.wxTextCtrl.__init__(...,style=wx.wxTE_MULTILINE)
wx.EVT_KEY_DOWN(self,self.onKeyDown)
def onKeyDown(self,event):
if event.GetKeyCode()!=wx.WXK_BACK:
event.Skip()
This prevents characters to be deleted by Backspace on Linux, but MSW
doesn't care whether Skip() is called or not. And the same applies to
WXK_RETURN,WXK_TAB (and maybe others). (WXK_LEFT,WXK_UP acts as expected
on MSW too.)
Is there any way to fool Windoze? Or am I going to the wrong way?
Thanks,
Zoltan Szalay
You should probably use:
EVT_CHAR instead of EVT_KEY_DOWN... At least it is working fine under
Windows
with wxPython 2.2.5.
see the code attached.
Bye,
Lucas
-----Message d'origine-----
editapp3.py (3.08 KB)
···
De : wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]De la part de Zoltan
Szalay
Envoyé : mercredi 11 avril 2001 14:03
À : wxpython-users@lists.wxwindows.org
Objet : [wxPython] preventing wxTextCtrl to process key-events
Is there any way to prevent wxTextCtrl to process key-events on MSW?
I have some code that works fine on Linux+wxPython (2.2.5), but not at
all in Win32 environment (+wxPython 2.2.5).
class MyTextCtrl(wx.wxTextCtrl):
def __init__(...):
wx.wxTextCtrl.__init__(...,style=wx.wxTE_MULTILINE)
wx.EVT_KEY_DOWN(self,self.onKeyDown)
def onKeyDown(self,event):
if event.GetKeyCode()!=wx.WXK_BACK:
event.Skip()
This prevents characters to be deleted by Backspace on Linux, but MSW
doesn't care whether Skip() is called or not. And the same applies to
WXK_RETURN,WXK_TAB (and maybe others). (WXK_LEFT,WXK_UP acts as expected
on MSW too.)
Is there any way to fool Windoze? Or am I going to the wrong way?
Thanks,
Zoltan Szalay
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
The sample app you've sent uses EVT_KEY_DOWN too, not EVT_CHAR, and still
doesn't work on my system.
Lucas Bruand wrote:
···
You should probably use:
EVT_CHAR instead of EVT_KEY_DOWN... At least it is working fine under
Windows
with wxPython 2.2.5.
see the code attached.
Bye,
Lucas
-----Message d'origine-----
De : wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]De la part de Zoltan
Szalay
Envoyé : mercredi 11 avril 2001 14:03
À : wxpython-users@lists.wxwindows.org
Objet : [wxPython] preventing wxTextCtrl to process key-events
Is there any way to prevent wxTextCtrl to process key-events on MSW?
I have some code that works fine on Linux+wxPython (2.2.5), but not at
all in Win32 environment (+wxPython 2.2.5).
class MyTextCtrl(wx.wxTextCtrl):
def __init__(...):
wx.wxTextCtrl.__init__(...,style=wx.wxTE_MULTILINE)
wx.EVT_KEY_DOWN(self,self.onKeyDown)
def onKeyDown(self,event):
if event.GetKeyCode()!=wx.WXK_BACK:
event.Skip()
This prevents characters to be deleted by Backspace on Linux, but MSW
doesn't care whether Skip() is called or not. And the same applies to
WXK_RETURN,WXK_TAB (and maybe others). (WXK_LEFT,WXK_UP acts as expected
on MSW too.)
Is there any way to fool Windoze? Or am I going to the wrong way?
Thanks,
Zoltan Szalay
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
------------------------------------------------------------------------
Name: editapp3.py
editapp3.py Type: Plain Text (text/plain)
Encoding: quoted-printable
Sorry I sent the wrong programme. the sample attached was the one you were
supposed to receive. It is working on my system (MSwin and Linux...) . I
hope it is working on yours as well. I guess the real reason of your problem
is that wxPython under MSwin is using EVT_KEY_UP instead of EVT_KEY_DOWN as
the trigger to add a new character in wxTextCtrl.
Bye,
Lucas
-----Message d'origine-----
editapp3.py (3.08 KB)
···
De : wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]De la part de Zoltan
Szalay
Envoyé : mercredi 11 avril 2001 14:41
À : wxpython-users@lists.wxwindows.org
Objet : Re: [wxPython] preventing wxTextCtrl to process key-events
The sample app you've sent uses EVT_KEY_DOWN too, not EVT_CHAR, and still
doesn't work on my system.
Lucas Bruand wrote:
You should probably use:
EVT_CHAR instead of EVT_KEY_DOWN... At least it is working fine under
Windows
with wxPython 2.2.5.
see the code attached.
Bye,
Lucas
-----Message d'origine-----
De : wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]De la part de Zoltan
Szalay
Envoyé : mercredi 11 avril 2001 14:03
À : wxpython-users@lists.wxwindows.org
Objet : [wxPython] preventing wxTextCtrl to process key-events
Is there any way to prevent wxTextCtrl to process key-events on MSW?
I have some code that works fine on Linux+wxPython (2.2.5), but not at
all in Win32 environment (+wxPython 2.2.5).
class MyTextCtrl(wx.wxTextCtrl):
def __init__(...):
wx.wxTextCtrl.__init__(...,style=wx.wxTE_MULTILINE)
wx.EVT_KEY_DOWN(self,self.onKeyDown)
def onKeyDown(self,event):
if event.GetKeyCode()!=wx.WXK_BACK:
event.Skip()
This prevents characters to be deleted by Backspace on Linux, but MSW
doesn't care whether Skip() is called or not. And the same applies to
WXK_RETURN,WXK_TAB (and maybe others). (WXK_LEFT,WXK_UP acts as expected
on MSW too.)
Is there any way to fool Windoze? Or am I going to the wrong way?
Thanks,
Zoltan Szalay
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
------------------------------------------------------------------------
Name: editapp3.py
editapp3.py Type: Plain Text (text/plain)
Encoding: quoted-printable
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
Thanks a looooot. It works, I will modify the code according to this. I wonder what
will go wrong on Linux
Zoltan Szalay
Lucas Bruand wrote:
···
Sorry I sent the wrong programme. the sample attached was the one you were
supposed to receive. It is working on my system (MSwin and Linux...) . I
hope it is working on yours as well. I guess the real reason of your problem
is that wxPython under MSwin is using EVT_KEY_UP instead of EVT_KEY_DOWN as
the trigger to add a new character in wxTextCtrl.
Bye,
Lucas
-----Message d'origine-----
De : wxpython-users-admin@lists.wxwindows.org
[mailto:wxpython-users-admin@lists.wxwindows.org]De la part de Zoltan
Szalay
Envoyé : mercredi 11 avril 2001 14:41
À : wxpython-users@lists.wxwindows.org
Objet : Re: [wxPython] preventing wxTextCtrl to process key-events
The sample app you've sent uses EVT_KEY_DOWN too, not EVT_CHAR, and still
doesn't work on my system.
Lucas Bruand wrote:
> You should probably use:
> EVT_CHAR instead of EVT_KEY_DOWN... At least it is working fine under
> Windows
> with wxPython 2.2.5.
> see the code attached.
> Bye,
> Lucas
>
> -----Message d'origine-----
> De : wxpython-users-admin@lists.wxwindows.org
> [mailto:wxpython-users-admin@lists.wxwindows.org]De la part de Zoltan
> Szalay
> Envoyé : mercredi 11 avril 2001 14:03
> À : wxpython-users@lists.wxwindows.org
> Objet : [wxPython] preventing wxTextCtrl to process key-events
>
> Is there any way to prevent wxTextCtrl to process key-events on MSW?
> I have some code that works fine on Linux+wxPython (2.2.5), but not at
> all in Win32 environment (+wxPython 2.2.5).
>
> class MyTextCtrl(wx.wxTextCtrl):
> def __init__(...):
> wx.wxTextCtrl.__init__(...,style=wx.wxTE_MULTILINE)
> wx.EVT_KEY_DOWN(self,self.onKeyDown)
> def onKeyDown(self,event):
> if event.GetKeyCode()!=wx.WXK_BACK:
> event.Skip()
>
> This prevents characters to be deleted by Backspace on Linux, but MSW
> doesn't care whether Skip() is called or not. And the same applies to
> WXK_RETURN,WXK_TAB (and maybe others). (WXK_LEFT,WXK_UP acts as expected
> on MSW too.)
>
> Is there any way to fool Windoze? Or am I going to the wrong way?
>
> Thanks,
> Zoltan Szalay
>
> _______________________________________________
> wxpython-users mailing list
> wxpython-users@lists.wxwindows.org
> http://lists.wxwindows.org/mailman/listinfo/wxpython-users
>
> ------------------------------------------------------------------------
> Name: editapp3.py
> editapp3.py Type: Plain Text (text/plain)
> Encoding: quoted-printable
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwindows.org
http://lists.wxwindows.org/mailman/listinfo/wxpython-users
------------------------------------------------------------------------
Name: editapp3.py
editapp3.py Type: Plain Text (text/plain)
Encoding: quoted-printable