• 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: Magnus Strand <email@hidden>
  • Date: Sat, 29 Jan 2005 11:23:53 +0100

Hi Jeremy,

It didn't work, NSFormCell doesn't have a currentEditor method,
also I tried with [myForm currentEditor] insertText..., but it didn't work either.


But I got help with an alternative solution to add a action category method to
NSView and in this do:
[self insertText:@"foo"]



Magnus

Jeremy French wrote:

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?





--
Med vänliga hälsningar

Magnus Strand
System Developer, MSc

email@hidden
Direct: +46 40 601 57 16
Office: +46 40 601 57 00
Mobile: +46 704 20 57 16

Teknik i Media AB
Södra Förstadsgatan 2
SE-211 43 Malmö
Sweden

_______________________________________________
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


References: 
 >How to insert text on button click? (From: Magnus Strand <email@hidden>)
 >Re: How to insert text on button click? (From: Jeremy French <email@hidden>)

  • Prev by Date: Re: I love Cocoa, but...
  • Next by Date: using 'cp' with NSTask - Thanks for the help!
  • Previous by thread: Re: How to insert text on button click?
  • Next by thread: Arrow-keys as Key Equivalents in IB
  • Index(es):
    • Date
    • Thread