| | |
RichTextCtrl - Delete key not working?
![]() |
•
•
Join Date: Nov 2008
Posts: 41
Reputation:
Solved Threads: 1
Hi, I have written a nice little editor using the RichTextCtrl, and so far everything is working fine, however, for some reason the delete key does not work as expected.
If I select something and hit delete then the selection is removed, but if I click anywhere in the text and hit delete, the text remains unchanged (Instead of being 'sucked' into the cursor).
Anyone have any ideas?
Cheers
Max
If I select something and hit delete then the selection is removed, but if I click anywhere in the text and hit delete, the text remains unchanged (Instead of being 'sucked' into the cursor).
Anyone have any ideas?
Cheers
Max
Yeah i got the same issue when i did a program using a richtextctrl.
I fixed it by binding the delete key to an event where i called something along the lines of
I remember having to bind it to a wx.EVT_KEY_DOWN event because i could not find one for DELETE specifically so then i just checked in the method to see if it was the delete key and then if it was the method continued to run.
I fixed it by binding the delete key to an event where i called something along the lines of
python Syntax (Toggle Plain Text)
self.text.SetSelection(self.text.GetCursor()[0],self.text.GetCursor()[1]+1) self.text.DeleteSelection()
I remember having to bind it to a wx.EVT_KEY_DOWN event because i could not find one for DELETE specifically so then i just checked in the method to see if it was the delete key and then if it was the method continued to run.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
•
•
Join Date: Nov 2008
Posts: 41
Reputation:
Solved Threads: 1
Hey Paul, thanks.
But it didn't work. I already bind to EVT_RICHTEXT_CHARACTER (Delete doesn't work with or without it), but no matter which event I use, the delete key is not doing anything, and that includes firing these events.
I also found and tried the EVT_RICHTEXT_DELETE, which picks up backspace quite nicely, but again, the Delete key doesn't even fire the event. Using EVT_KEY_DOWN works for everything on the keyboard except the delete key, and thats right up to the point where the Delete key doesn't fire the event!
And yes, the Delete key is fine!
And here's the really weird thing: If I make sure that NumLock is in the right place, the Del key on the keypad works exactly as its supposed to!
I just don't know where to go with this next, and I'm at the point of giving up and using the keypad Del key instead, as much as it annoys me to do so.
Got any ideas?
Max
But it didn't work. I already bind to EVT_RICHTEXT_CHARACTER (Delete doesn't work with or without it), but no matter which event I use, the delete key is not doing anything, and that includes firing these events.
I also found and tried the EVT_RICHTEXT_DELETE, which picks up backspace quite nicely, but again, the Delete key doesn't even fire the event. Using EVT_KEY_DOWN works for everything on the keyboard except the delete key, and thats right up to the point where the Delete key doesn't fire the event!
And yes, the Delete key is fine!
And here's the really weird thing: If I make sure that NumLock is in the right place, the Del key on the keypad works exactly as its supposed to!
I just don't know where to go with this next, and I'm at the point of giving up and using the keypad Del key instead, as much as it annoys me to do so.
Got any ideas?
Max
Well my next and last step would be to go to the wxpython mailing list and see if anyone there can help, i find if there is ever a problem in wx that cannot be fixed, that the mailing list really does the trick.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Check out my Site | and join us on IRC | Python Specific IRC
![]() |
Other Threads in the Python Forum
- Previous Thread: Is List Equivalent to Arrays?
- Next Thread: how to use the shutil.copy() statement?
| Thread Tools | Search this Thread |
abrupt accessdenied anti apache application approximation argv array beginner book builtin calculator change converter countpasswordentry curved dan08 dictionaries dictionary dynamic edit enter examples file float format function gui heads homework import inches input java keyboard lapse launcher library line lines linux list lists loop microphone mouse movingimageswithpygame mysqlquery newb number numbers numeric output parameters parsing path phonebook plugin port prime programming projects py2exe pygame pyopengl python random recursion redirect remote reverse scrolledtext session simple software sprite statictext string strings syntax table terminal text textarea thread threading time tlapse trick tuple tutorial twoup ubuntu unicode unit urllib urllib2 variable wordgame wxpython





