Hi, I''m using TextCtrl and initially set some text in it. And all the text is selected by default. How can I deselect it? By the way, TextCtrl#set_selection() doesn''t work... What am I doing wrong? Thanks a lot, Kirill. Here''s the sample: ====================== wxtest.rb ==========================require ''wx'' class TestFrame < Wx::Frame def initialize super(nil, -1, "Test") text = Wx::TextCtrl.new(self, -1, "first_line\n", :style => Wx::TE_RICH|Wx::TE_RICH2|Wx::TE_MULTILINE) text.append_text "second line" text.set_selection(3, 4) end end class TestApp < Wx::App def on_init TestFrame.new.show end end TestApp.new.main_loop _______________________________________________ wxruby-users mailing list wxruby-users@rubyforge.org http://rubyforge.org/mailman/listinfo/wxruby-users
?????? ????????? wrote> I''m using TextCtrl and initially set some text in it. And all the text > is selected by default. > How can I deselect it? > By the way, TextCtrl#set_selection() doesn''t work... What am I doing > wrong?Thanks for reporting this and providing a clear test case. I''ve tried it out and it seems to be a bug, specific to Windows. I was a bit surprised as I''m fairly sure this used to work. If you''re able, please could you file this on the bug tracker and attach your example as a test case. This will be a MUSTFIX for 2.0. By the way, if you''re using RICH and RICH2 for formatting, you might see if RichTextCtrl works better for you. TextCtrl + RICH2 has some cross-platform quirks, although it will be better for accessibility I guess. thanks alex
> > >> Thanks for reporting this and providing a clear test case. I''ve tried it > out and it seems to be a bug, specific to Windows. I was a bit surprised as > I''m fairly sure this used to work. > > If you''re able, please could you file this on the bug tracker and attach > your example as a test case. This will be a MUSTFIX for 2.0.Done: http://rubyforge.org/tracker/index.php?func=detail&aid=22686&group_id=35&atid=218 And it also didn''t work in 1.9.8, I just didn''t pay attention to it at that time. By the way, is it also a bug that the whole text is selected by default? By the way, if you''re using RICH and RICH2 for formatting, you might see if> RichTextCtrl works better for you. TextCtrl + RICH2 has some cross-platform > quirks, although it will be better for accessibility I guess.I''m not sure that I need all the power provided by RichTextCtrl, it looks that for my task simple TextCtrl is just fine. But I''ll try, thanks for pointing to it. Regards, Kirill. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081105/c3061f16/attachment-0001.html>
Kirill Likhodedov wrote:> Done: > http://rubyforge.org/tracker/index.php?func=detail&aid=22686&group_id=35&atid=218 > <http://rubyforge.org/tracker/index.php?func=detail&aid=22686&group_id=35&atid=218>Thanks> And it also didn''t work in 1.9.8, I just didn''t pay attention to it at > that time. > > By the way, is it also a bug that the whole text is selected by default?Yes, I think so. It doesn''t do this on other platforms. a