Forum: wxRuby Enter key issue with RichTextCtrl

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
00109e19a784b64f81b483a5dbec690a?d=identicon&s=25 Chauk-Mean Proum (chauk-mean)
on 2008-11-06 12:16
(Received via mailing list)
Hi,

I'm trying to use RichTextCtrl available with wxRuby 1.9.9 instead of
TextCtrl and the Enter key does not work (as what I expect).
With TextCtrl (with Wx::TE_MULTILINE), the Enter key creates a new line
of text.
With RichTextCtrl, the Enter key changes the focus to another widget.

I saw a workaround for wxPython with the style WANTS_CHARS but there
is no such constant in wxRuby.
Thanks in advance.

Chauk-Mean.
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2008-11-06 12:46
(Received via mailing list)
Hi Chauk-Mean

Chauk-Mean P wrote:
> I'm trying to use RichTextCtrl available with wxRuby 1.9.9 instead of
> TextCtrl and the Enter key does not work (as what I expect).
> With TextCtrl (with Wx::TE_MULTILINE), the Enter key creates a new line of text.
> With RichTextCtrl, the Enter key changes the focus to another widget.
>

Thanks for reporting this. I tried it out on OS X with my little
RichText sample, where the widget is created with the default style and
has no special event handling. The Enter key works as I'd expect - i.e.
inserts a new line.

Do you perhaps have an event handler defined that you need to call skip
on the event so that it's passed for normal processing?

> I saw a workaround for wxPython with the style WANTS_CHARS but there
> is no such constant in wxRuby.

Are you sure? It definitely seems to be available as Wx::WANTS_CHARS,
with the value 262144.

If not, please report as a bug.

cheers
alex
00109e19a784b64f81b483a5dbec690a?d=identicon&s=25 Chauk-Mean Proum (chauk-mean)
on 2008-11-06 14:00
(Received via mailing list)
Hi Alex,

2008/11/6 Alex Fenton <alex@pressure.to>:
> Thanks for reporting this. I tried it out on OS X with my little RichText
> sample, where the widget is created with the default style and has no
> special event handling. The Enter key works as I'd expect - i.e. inserts a
> new line.

I forgot to mention that I'm using Windows XP.

> Do you perhaps have an event handler defined that you need to call skip on
> the event so that it's passed for normal processing?

I don't have any event handler on the RichTextCtrl.

>> I saw a workaround for wxPython with the style WANTS_CHARS but there
>> is no such constant in wxRuby.
>
> Are you sure? It definitely seems to be available as Wx::WANTS_CHARS, with
> the value 262144.

Oups ! I wrote the constant correctly in this message but in my code I
wrote Wx::ACCEPTS_CHARS !!
Now, with a style set to Wx::WANTS_CHARS, RichTextCtrl works as
expected.
So the workaround is actually applicable.
This may be defined as the default style at the the wxRuby level if
this does not harm on OSX and Linux.

Also, do you have / intend to add a RichTextCtrl sample ?

Cheers.

Chauk-Mean.
06f6780c99d4a8dd71f2b474082ea9ce?d=identicon&s=25 Alex Fenton (Guest)
on 2008-11-06 15:45
(Received via mailing list)
Chauk-Mean P wrote:
> Oups ! I wrote the constant correctly in this message but in my code I
> wrote Wx::ACCEPTS_CHARS !!
> Now, with a style set to Wx::WANTS_CHARS, RichTextCtrl works as expected.
> So the workaround is actually applicable.
> This may be defined as the default style at the the wxRuby level if
> this does not harm on OSX and Linux.
>

I'm a bit surprised that it behaves like this by default on Windows. I
would have thought that the standard desirable behaviour for this kind
of text editing widget would be to always consume Enter strokes.

I'll check that it's not something introduced by the wrapping, and if
not, will do as you suggest.

> Also, do you have / intend to add a RichTextCtrl sample ?
>
I don't have one in a good enough state to be added, just a mishmash of
stuff I used to test the various features as I added them. It would be
very good to have a sample - I don't think it has to be as complex as
the wxWidgets one - but at the moment writing samples is for me less of
a priority than finishing the core lib. Contributions welcome.

cheers
alex
This topic is locked and can not be replied to.