| | |
RichTextCtrl - Delete key not working?
Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
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 |
alarm app beginner cipher cmd cx-freeze data decimals development dictionary directory dynamic error examples feet file float format ftp function generator getvalue gui halp homework http images import input ip itunes java keycontrol leftmouse line linux list lists logging loop maintain maze millimeter module mouse mysqldb number numbers output parsing path port prime programming projects push py2exe pygame pyglet pyqt python queue random recursion schedule screensaverloopinactive script scrolledtext slicenotation sqlite ssh string strings sudokusolver table terminal text thread threading time tkinter tlapse tuple tutorial ubuntu unicode url urllib urllib2 variable variables ventrilo verify vigenere web webservice wikipedia windows wxpython xlwt





