• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: How to insert text on button click?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to insert text on button click?


  • Subject: Re: How to insert text on button click?
  • From: Jeremy French <email@hidden>
  • Date: Thu, 27 Jan 2005 15:01:45 -0500

In the button's action method do the following; also note I'm referring to the instance of your NSForm object as "myForm":

* figure out which cell has the insertion point with

[myForm selectedCell]

* get a reference to the above cell's current field editor

id theEditor = [[myForm selectedCell] currentEditor]

* now insert the text you want

[theEditor insertText:@"some text to insert"]


On Jan 26, 2005, at 9:40 AM, Magnus Strand wrote:

I have a window with buttons, an NSForm with text fields etc.
When the user clicks a button I would like to insert some characters
where the text caret is blinking.
How can I do this?


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: How to insert text on button click?
      • From: Magnus Strand <email@hidden>
References: 
 >How to insert text on button click? (From: Magnus Strand <email@hidden>)

  • Prev by Date: A Question about cocoa-text.
  • Next by Date: Re: A Question about cocoa-text.
  • Previous by thread: How to insert text on button click?
  • Next by thread: Re: How to insert text on button click?
  • Index(es):
    • Date
    • Thread