Can''t get this function working, does any body know where I''m wrong ? @term = Wx::TextCtrl.new(@skin, -1, ''Paste URL Here'', :pos => [25,100], :size => [300,20]) #, :style => Wx::NO_BORDER) @term.evt_set_focus() {|event| on_term_focus(event) } def on_term_focus(event) if @term.get_value == "Paste URL Here" @term.set_value("") else @term.set_selection(-1,-1) #<---- DON''T WORK end end -- Posted via http://www.ruby-forum.com/.
Fabio Petrucci
2010-Oct-08 16:35 UTC
[wxruby-users] TextCtrl#set_selection problem.. need help, please
try to skip: def on_term_focus(event) if @term.get_value == "Paste URL Here" @term.set_value("") else @term.set_selection(-1,-1) end evt.skip() end hth bio. On Fri, Oct 8, 2010 at 5:07 PM, Rob Doug <lists at ruby-forum.com> wrote:> Can''t get this function working, does any body know where I''m wrong ? > > @term = Wx::TextCtrl.new(@skin, -1, ''Paste URL Here'', :pos => [25,100], > :size => [300,20]) #, :style => Wx::NO_BORDER) > @term.evt_set_focus() {|event| on_term_focus(event) } > > def on_term_focus(event) > if @term.get_value == "Paste URL Here" > @term.set_value("") > else > @term.set_selection(-1,-1) #<---- DON''T WORK > end > end > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > wxruby-users mailing list > wxruby-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/wxruby-users >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20101008/af9867dc/attachment.html>
Fabio Petrucci
2010-Oct-08 16:37 UTC
[wxruby-users] TextCtrl#set_selection problem.. need help, please
sorry event.skip() On Fri, Oct 8, 2010 at 6:35 PM, Fabio Petrucci <fabio.petrucci at gmail.com>wrote:> try to skip: > > > def on_term_focus(event) > if @term.get_value == "Paste URL Here" > @term.set_value("") > else > @term.set_selection(-1,-1) > end > evt.skip() > end > > hth > bio. > > > On Fri, Oct 8, 2010 at 5:07 PM, Rob Doug <lists at ruby-forum.com> wrote: > >> Can''t get this function working, does any body know where I''m wrong ? >> >> @term = Wx::TextCtrl.new(@skin, -1, ''Paste URL Here'', :pos => [25,100], >> :size => [300,20]) #, :style => Wx::NO_BORDER) >> @term.evt_set_focus() {|event| on_term_focus(event) } >> >> def on_term_focus(event) >> if @term.get_value == "Paste URL Here" >> @term.set_value("") >> else >> @term.set_selection(-1,-1) #<---- DON''T WORK >> end >> end >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> wxruby-users mailing list >> wxruby-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/wxruby-users >> > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/wxruby-users/attachments/20101008/5717dd2e/attachment.html>
Rob Doug
2010-Oct-08 17:38 UTC
[wxruby-users] TextCtrl#set_selection problem.. need help, please
Fabio Petrucci wrote:> sorry event.skip()Unfortunately it didn''t help -- Posted via http://www.ruby-forum.com/.
Felipe Rojas
2010-Oct-14 11:50 UTC
[wxruby-users] TextCtrl#set_selection problem need help, please
> @term.set_selection(-1,-1) #<---- DON''T WORK >Hi Rob, I have the same problem with a ListCtrl Object, and the solution for me is to REFRESH the ListCtrl after the selection: > ListCtrl#set_item_state( ) > ListCtrl#refresh_items( ) I hope it helps FELIPE -- Posted via http://www.ruby-forum.com/.