Opened 11 years ago

Closed 21 months ago

#1480 closed defect (fixed)

Initially focused wxDialog control doesn't get EVT_SET_FOCUS

Reported by: kasplat Owned by:
Priority: normal Milestone:
Component: wxOSX-Cocoa Version:
Keywords: focus Cc: kasplat
Blocked By: Blocking:
Patch: no


Per Robin's request I'm submitting this as a bug...

Kevin said:
It looks like we are back to auto-selecting the text of a
TextEntryDialog when the dialog appears on Windows. This is fine
with me, but the Mac version doesn't do this. I seem to remember
us discussing this before, is the lack of text selection a Apple
Human Interface Guideline (HIG) or is the Mac code just lagging
behind? I dislike the lack of text selection for single line fields in
text dialogs, so I'm curious :)

Hmm, I just tested on Windows and Mac to double-check behaviour
of plain TextCtrls and it looks like on Windows as you tab between
fields all the text is auto-selected for plain, password, and
TE_RICH2 styles. On the Mac however, all the text is selected for
the password field, but the cursor position is remembered for plain
and rich text style variations, so the text isn't auto-selected. I love
cross-platform issues ;-)

Robin said:
TextCtrl auto selection is up to the specific wx port to implement or
not. wxMSW does it because it is common behavior in other
Windows apps. wxMac probably should do it too as I see it
happening there too (System Prefrences for example,) although I
don't know if the HIG has anythign to say about it or not. Please
enter a bug report about this.

Change History (5)

comment:1 Changed 10 years ago by kasplat

2.5.2.x ping. Either this should be closed or the behavior
implemented on the Mac. As of 2.5.2.x the Mac remembers
the selection and insertion point as you tab between fields on
a panel.

The text is selected for single-line TextEntryDialog input,
which was the main thing that seemed to be broken when I
posted this bug report.

If this matches the Mac HIG then this should definitely be

comment:2 Changed 2 years ago by oneeyeman

Just tested the behavior on the dialogs sample with "Single Line Entry".

Starting the dialog the string is not selected and the caret is at the very first position. If pressing TAB 3 times, the focus comes back to the text control and the text becomes selected.

The testing was done on wxWidgets-2.9.4 configured to build as "--with-osx_cocoa --mac-version-min=10.6" on the Snow Leopard 10.6.7.

comment:3 Changed 23 months ago by oneeyeman

Are we going to close this?

It looks like Mac conforms to the common behavior now...

comment:4 Changed 22 months ago by vadz

  • Component changed from wxOSX-Carbon to wxOSX-Cocoa
  • Keywords focus added
  • Status changed from new to confirmed
  • Summary changed from TextCtrl selections to Initially focused wxDialog control doesn't get EVT_SET_FOCUS

Your own comment:2 seems to indicate that the bug is still present because the string is not initially selected, so I really struggle to understand why do you think it should be closed.

It is probably related to the other focus bugs in wxOSX in modal dialogs as the text is initially selected if you have a wxTextCtrl in a frame but it doesn't work for the text entry dialog (Cmd-E in the dialogs sample).

comment:5 Changed 21 months ago by SC

  • Resolution set to fixed
  • Status changed from confirmed to closed

(In [73046]) supporting selection methods when not focused, closes #1480

Note: See TracTickets for help on using tickets.