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

Recommended Answers

All 8 Replies

try using wx.EVT_TEXT and bind it to the Rich Text control.

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

I think the better way would just be to map CTRL+<character> to the items under an Edit menu.

ie,

File, Edit, Help
       |_Bold Ctrl+B
       |_Italic Ctrl+I

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

Are you trying to make a text editor? In my opinion, a text editor would most definitely benefit from a menu system.

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

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...

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.