2

I'm sorry to ask this again, I've looked over all the related questions here, but none seems to help me (or I just can't get it).

Atm, I have an NSTextField that operates like every other of its kind, but it needs double-to-triple click to select all of it's content for editing (double selects one word, triple - all of them).

I unfortunately need this to work in a way, that when a user clicks on it once, all the text gets selected, so one can start typing a new thing instantly.

Mikk Rätsep
  • 512
  • 7
  • 20

1 Answers1

3

Basically you should follow the solutions in this duplicate question

and once you are in your own derived -(void) mouseDown: (NSEvent *) theEvent method, simply select all the text by doing calls to either

[NSTextField selectText:]

or

[NSText setSelectedRange:]

Community
  • 1
  • 1
Michael Dautermann
  • 88,797
  • 17
  • 166
  • 215