wxRichTextCtrl question Topic is solved

This forum can be used to talk about general design strategies, new ideas and questions in general related to wxWidgets. If you feel your questions doesn't fit anywhere, put it here.
Post Reply
Lefteris
Experienced Solver
Experienced Solver
Posts: 70
Joined: Tue Sep 16, 2008 8:32 am
Location: Thessaloniki, Greece

wxRichTextCtrl question

Post by Lefteris »

Hello all, I have a question about wxRichTextCtrl.

Isn't it supposed to be multiline by default? I am pressing enter and it is not changing line. I tried to add something like that and do it by myself:

Code: Select all

EVT_TEXT_ENTER(wxID_ANY,AlgorithmPanel::newLine)
But still it does not work and it does not add new lines. Moreover I can not see what I am selecting. I mean it is not highlighted when I select something, hence I am not able to see if I selected anything at all, even though it DOES select.

Is there some event I can catch in the event table so that I can highlight the selected text? Thanks for any help answering these two questions!
Lefteris
Experienced Solver
Experienced Solver
Posts: 70
Joined: Tue Sep 16, 2008 8:32 am
Location: Thessaloniki, Greece

Post by Lefteris »

I am sorry for double posting but I still have not figured out how to "catch" the ENTER key being pressed in a RichTextCtrl. So I am not able to add new lines to my text. Is there really no way to do it? I mean ... it can't be. Any help?

Documentation suggests that I have to add the wxTE_PROCCESS_ENTER flag to the constructor and then just do it as if it is a wxTextCtrl but that does not work.
Sof_T
Can't get richer than this
Can't get richer than this
Posts: 864
Joined: Thu Jul 28, 2005 9:48 pm
Location: New Forest, United Kingdom
Contact:

Post by Sof_T »

with wxRichTextCtrl won't you need to catch the EVT_RICHTEXT_RETURN event? Are you sure you are using wxRichTextCtrl and not wxTextCtrl?
The home of Sof.T http://www.sof-t.site88.net/
Author of Programming with wxDevC++
http://sourceforge.net/projects/wxdevcpp-book/
Lefteris
Experienced Solver
Experienced Solver
Posts: 70
Joined: Tue Sep 16, 2008 8:32 am
Location: Thessaloniki, Greece

Post by Lefteris »

Yeah ofcourse I am sure. Also I tried catching the return event too, and the result is the same. Nothing. Quoting the documentation:
wxRichTextCtrl sends notification events: see wxRichTextEvent. It also sends the standard wxTextCtrl events wxEVT_COMMAND_TEXT_ENTER and wxEVT_COMMAND_TEXT_UPDATED, and wxTextUrlEvent when URL content is clicked.
sabir
In need of some credit
In need of some credit
Posts: 8
Joined: Wed Feb 13, 2008 1:38 am
Location: india
Contact:

Post by sabir »

You need to use wxWANTS_CHARS flag for your wxRichTextCtrl - you'll find it's description among wxWindow's styles.


Lefteris wrote:Yeah ofcourse I am sure. Also I tried catching the return event too, and the result is the same. Nothing. Quoting the documentation:
wxRichTextCtrl sends notification events: see wxRichTextEvent. It also sends the standard wxTextCtrl events wxEVT_COMMAND_TEXT_ENTER and wxEVT_COMMAND_TEXT_UPDATED, and wxTextUrlEvent when URL content is clicked.
Sabir
Lefteris
Experienced Solver
Experienced Solver
Posts: 70
Joined: Tue Sep 16, 2008 8:32 am
Location: Thessaloniki, Greece

Post by Lefteris »

Thank you , sabir. I owe you a debt of gratitude. I could not find the solution to this and just skipped it and proceeded with the rest of the development of the program.

Your solution works! I now understand that wxRichTextCtrl does not generate events for enter key presses or tab key presses UNLESS you include the wxWANT_CHARS flags into the contructor.

Thanks again.
Post Reply