Forum: wxRuby TextCtrl#set_selection problem.. need help, please

Posted by Rob Doug (robdoug)
on 2010-10-08 17:07
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 by Fabio Petrucci (biospank)
on 2010-10-08 18:37
(Received via mailing list)
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.
Posted by Fabio Petrucci (biospank)
on 2010-10-08 18:42
(Received via mailing list)
sorry event.skip()
Posted by Rob Doug (robdoug)
on 2010-10-08 19:38
Fabio Petrucci wrote:
> sorry event.skip()

Unfortunately it didn't help
Posted by Felipe Rojas (cdigital)
on 2010-10-14 13:50
>       @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
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.