From: Mattia B. <mat...@li...> - 2006-07-10 22:16:56
|
On Mon, 10 Jul 2006 19:41:58 +0200 "Grumm, Carsten" <car...@ch...> wrote: Hi, > I'm trying to have all text selected when a user enters the textcontrol. > I've tried using EVT_SET_FOCUS like this: > > sub OnSetFocus { > my ($this, $event) = @_; > $this->SetSelection(-1, -1); > } > > ... but that doesn't work. > > I've found some Pythoncode > (http://aspn.activestate.com/ASPN/Mail/Message/wxPython-users/2086900) > where Wx::CallAfter is used, but I don't know how to do this in wxPerl? CallAfter is just a nice wrapper for calling a function once in idle time (must implement it in wxPerl, too). Just set a flag in EVT_FOCUS, and in EVT_IDLE call SetSelection iff the flag is set. HTH Mattia |