List Info

Thread: SelectAll when focus is obtained due to click




SelectAll when focus is obtained due to click
user name
2007-10-15 14:40:54
Hi all, I need to select all contents from a TextCtrl when the control gets focus. I catch SET_FOCUS events on the textctrl and call selectAll from CallAfter, as suggested in another thread of this list. But still when the focus is gained by clicking over the control contents (not over the empty section but where there already is text), selection is cleaned up immediately after entering the control. A workaround is calling CallLater with a sensible timeout instead of CallLater but this won't be bulletproof and produces an anti-esthetic flicker. Is it possible to avoid this automatic text deselection? I'm using libwxgtk-2.8.6. TIA. Regards -Carlos
Re: SelectAll when focus is obtained due to click
country flaguser name
United States
2007-10-16 18:38:57
Carlos Pita wrote:
> Hi all, I need to select all contents from a TextCtrl
when the control 
> gets focus. I catch SET_FOCUS events on the textctrl
and call selectAll 
> from CallAfter, as suggested in another thread of this
list. But still 
> when the focus is gained by clicking over the control
contents (not over 
> the empty section but where there already is text),
selection is cleaned 
> up immediately after entering the control. A workaround
is calling 
> CallLater with a sensible timeout instead of CallLater
but this won't be 
> bulletproof and produces an anti-esthetic flicker. Is
it possible to 
> avoid this automatic text deselection? I'm using
libwxgtk-2.8.6. TIA. 

It's happening because of the repositioning of the caret at
the clicked 
location, which is essentially the same as setting the
selection to 
(pos, pos).  You can try intercepting the mouse-down and
mouse-up events 
and avoiding the default set position that is happening
there

-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java
give you jitters?  Relax with wxPython!


------------------------------------------------------------
---------
To unsubscribe, e-mail: wxPython-users-unsubscribelists.wxwidgets.org
For additional commands, e-mail: wxPython-users-helplists.wxwidgets.org


[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )