Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > text field input retrieval

text field input retrieval
Thread Tools
Registered User
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jul 19, 2002, 03:18 AM
 
I'm wondering how I can set up a text field control so that when the user presses enter(and or return) it triggers some kind of event to let the application know that it can extract the data from the control and manipulate it's contents

Thanx in advance
     
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 19, 2002, 04:41 AM
 
What language and frameworks are you using?
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
Professional Poster
Join Date: Dec 2000
Location: Chicago, Illinois
Status: Offline
Reply With Quote
Jul 19, 2002, 12:14 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by lenz:
<strong>I'm wondering how I can set up a text field control so that when the user presses enter(and or return) it triggers some kind of event to let the application know that it can extract the data from the control and manipulate it's contents

Thanx in advance</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Do you have a good feel for target-action? What you need to do is set up an action method in the class you want to recieve the returns/end editing event. It would look something like this:

</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">- (IBAction)catchTextFieldDidEndEditingNSTextField *)sender
{
//do something
}</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Then, you need to set your textField's action method ot be catchTextFieldDidEndEditing: Hopefully the class that you put this method in is instantiated in IB (usually its your controller class). All you have to do is add this method to the set of action methods for the class that should catch the end editing event and then draw a connector from the text field to your instantiated object and select the appropriate action method (Is it control drag or option drag, I never remember).

If any of this lost you, I'd suggest reading the Currency Converter Cocoa tutorial.

HTH,
Matt Fahrenbacher
     
Dedicated MacNNer
Join Date: May 2001
Status: Offline
Reply With Quote
Jul 19, 2002, 12:31 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by lenz:
<strong>I'm wondering how I can set up a text field control so that when the user presses enter(and or return) it triggers some kind of event to let the application know that it can extract the data from the control and manipulate it's contents

Thanx in advance</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Yeah-- this is fairly easy. There are plenty of examples online, and you can find a great walk-through in Aaron Hillegass's book "Cocoa Programming for Mac OS X" that takes you through the steps. Once you "get" how to do this, using any kind of control is pretty much the same procedure.

See <a href="http://www.bignerdranch.com" target="_blank">http://www.bignerdranch.com</a> for his book...but there are plenty of good programming sites around that have good examples and are free to boot.

W
     
lenz  (op)
Registered User
Join Date: Apr 2001
Status: Offline
Reply With Quote
Jul 19, 2002, 03:18 PM
 
I'm using c++ using the carbon frameworks but I think I follow the ObjC example. I'll give it a try

<small>[ 07-19-2002, 04:20 PM: Message edited by: lenz ]</small>
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 10:04 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2