[wx-dev] #9521: Select all when edit ctrl receives focus

wxTrac noreply at wxsite.net
Mon Jun 2 06:22:43 PDT 2008


Ticket URL: <http://trac.wxwidgets.org/ticket/9521>

#9521: Select all when edit ctrl receives focus
-----------------------------------+----------------------------------------
 Reporter:  doornik                |       Owner:       
     Type:  enhancement            |      Status:  new  
 Priority:  normal                 |   Milestone:       
Component:  wxMac                  |     Version:  2.8.x
 Keywords:  wxTextCtrl wxSpinCtrl  |   Blockedby:       
    Patch:  1                      |    Blocking:       
-----------------------------------+----------------------------------------
 When edit controls (text,combo,spin) receive the focus on a Mac, they
 should have the entire text selected, except when the focus was received
 by clicking inside the field. Example: first display of a dialog with
 focus in a text field, or tabbing in a dialog. All Mac
 apps behave like this (see e.g. Find/replace dlg in TextEdit), but not
 wxMac based apps.

 The attached textctrl patch solves the problem. It does have one potential
 drawback: any prior programmatic selection of part of the text is ignored.
 So an enhancement would be to keep track of programmatic selection
 setting, and only selecting all if no
 programmatic selection setting was used.

 Similarly, the spinctrl should select all when receiving focus.
 In particular, using
     if ( (from == -1) && (to == -1) )
     {
         from = 0;
     }
 in wxSpinCtrl::SetSelection is counter productive, because it prevents the
 default wx behaviour of selecting all.


--
Ticket URL: <http://trac.wxwidgets.org/ticket/9521>


More information about the wx-dev mailing list