[wxruby-users] How to deselect the text

Кирилл Лиходедов kirill.likhodedov at gmail.com
Wed Nov 5 05:10:24 EST 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20081105/3dad3276/attachment.html>


More information about the wxruby-users mailing list