943,616 Members | Top Members by Rank

Ad:
  • Python Discussion Thread
  • Unsolved
  • Views: 874
  • Python RSS
Feb 15th, 2009
0

RichTextCtrl - Delete key not working?

Expand Post »
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
Reputation Points: 10
Solved Threads: 1
Light Poster
MaxVK is offline Offline
46 posts
since Nov 2008
Feb 15th, 2009
0

Re: RichTextCtrl - Delete key not working?

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
python Syntax (Toggle Plain Text)
  1. self.text.SetSelection(self.text.GetCursor()[0],self.text.GetCursor()[1]+1)
  2. 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.
Reputation Points: 264
Solved Threads: 183
Veteran Poster
Paul Thompson is offline Offline
1,095 posts
since May 2008
Feb 16th, 2009
0

Re: RichTextCtrl - Delete key not working?

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
Reputation Points: 10
Solved Threads: 1
Light Poster
MaxVK is offline Offline
46 posts
since Nov 2008
Feb 16th, 2009
0

Re: RichTextCtrl - Delete key not working?

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.
Reputation Points: 264
Solved Threads: 183
Veteran Poster
Paul Thompson is offline Offline
1,095 posts
since May 2008
Feb 16th, 2009
0

Re: RichTextCtrl - Delete key not working?

Cheers Paul, Ill have to do some more hunting about.

Max
Reputation Points: 10
Solved Threads: 1
Light Poster
MaxVK is offline Offline
46 posts
since Nov 2008

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Python Forum Timeline: Is List Equivalent to Arrays?
Next Thread in Python Forum Timeline: how to use the shutil.copy() statement?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC