Detecting changes in RichTextCtrl

Thread Solved

Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Detecting changes in RichTextCtrl

 
0
  #1
Nov 10th, 2008
Hi there.

I am using a RichTextCtrl on a window with a toolbar. The toolbar has a save button on it that is disabled by default when the application starts.

I need this button to become enabled when the user changes something in the RichTextCtrl, but I'm having trouble working out how to detect such a change. I managed to create a KEY_DOWN event for the RichTextCtrl, but while that allowed me to enable the save button, it also prevented me from typing anything!

Can anyone point me in the right direction please?

regards

Max
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 895
Reputation: Paul Thompson has a spectacular aura about Paul Thompson has a spectacular aura about 
Solved Threads: 143
Sponsor
Paul Thompson's Avatar
Paul Thompson Paul Thompson is online now Online
previously paulthom12345

Re: Detecting changes in RichTextCtrl

 
0
  #2
Nov 10th, 2008
try using wx.EVT_TEXT and bind it to the Rich Text control.
Make it idiot proof and someone will make a better idiot.
Check out my Site | and join us on IRC | Python Specific IRC
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Re: Detecting changes in RichTextCtrl

 
0
  #3
Nov 11th, 2008
Ah thanks Paul - That did it!

I'm playing with the code now (at least until I have to do some more work!) and I want to pick up some key presses to activate various functions (Bold etc). Is this the right event to do this in, or is there a better way?

Regards

Max
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,046
Reputation: jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough 
Solved Threads: 263
Sponsor
jlm699's Avatar
jlm699 jlm699 is offline Offline
Knows where his Towel is

Re: Detecting changes in RichTextCtrl

 
0
  #4
Nov 11th, 2008
I think the better way would just be to map CTRL+<character> to the items under an Edit menu.

ie,
  1. File, Edit, Help
  2. |_Bold Ctrl+B
  3. |_Italic Ctrl+I
1. Use Code Tags.
2. Homework? Show Effort.
3. Keep discussions on the forum: no PMs
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Re: Detecting changes in RichTextCtrl

 
0
  #5
Nov 11th, 2008
Hmm, thanks. I was hoping to avoid a menu since it wouldn't necessarily fit into what the window would be doing, but it might prove the easiest way to do this.

Thanks for your help

Regards

Max
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,046
Reputation: jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough 
Solved Threads: 263
Sponsor
jlm699's Avatar
jlm699 jlm699 is offline Offline
Knows where his Towel is

Re: Detecting changes in RichTextCtrl

 
0
  #6
Nov 11th, 2008
Are you trying to make a text editor? In my opinion, a text editor would most definitely benefit from a menu system.
1. Use Code Tags.
2. Homework? Show Effort.
3. Keep discussions on the forum: no PMs
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Re: Detecting changes in RichTextCtrl

 
0
  #7
Nov 12th, 2008
Hmm. Text Editor. Well, sort of.

I'm an author, and the program is called 'Author Tool'. It does incorporate a text editor, but the menu would be sort of superfluous - As a tool it is designed to speed up my writing, which means Keyboard shortcuts for pretty much everything that I might do while actually typing. I use a toolbar for navigation, character creation etc.

I'm trying to re-write this program in Python, basically as a learning exercise - I have a copy that I use most days, written in Gambas.

Regards

Max
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 1,046
Reputation: jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough jlm699 is a jewel in the rough 
Solved Threads: 263
Sponsor
jlm699's Avatar
jlm699 jlm699 is offline Offline
Knows where his Towel is

Re: Detecting changes in RichTextCtrl

 
0
  #8
Nov 12th, 2008
I guess what you could do is set up a menu with the CTRL+<Letter> shortcuts binded and then just keep it hidden.

That way the bindings are taken care of but you don't have to see it...
1. Use Code Tags.
2. Homework? Show Effort.
3. Keep discussions on the forum: no PMs
Reply With Quote Quick reply to this message  
Join Date: Nov 2008
Posts: 41
Reputation: MaxVK is an unknown quantity at this point 
Solved Threads: 1
MaxVK MaxVK is offline Offline
Light Poster

Re: Detecting changes in RichTextCtrl

 
0
  #9
Nov 12th, 2008
Yes, I was thinking along those lines because it looks a lot simpler than setting up a large number of shortcuts for the rich text control.

Thanks

Max
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC