 |
 |
Interface Builder (Simple Question)
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
I was running throught the Cocoa tutorial (Currency Converter). Recall that this is a simple app that has three text fields and one button. I connected the first text field with second text field with a nextKeyView connection -and vice versa. I verified this by clicking on the exisiting connections in the "Show Info" window: the gray connection inmediately shows up, showing proper origin and destination for the nextKeyView messages.
So all that seems to be well. However, I when testing the GUI with the "Test Interface" option in Interface Builder and the tab sequence doesn't seem to work. It goes from the first text field to the second and then to the third. Proper expected behaviour (given my connections) is from the first text field to second text field and then back to first text field. I am perplexed in regards to why it goes to the third text field because I never connected that field with the any of the other two. What did I misunderstand here? Is the nextKeyView functionality suppose to provide the behaviour that I am expecting?
[This message has been edited by DaGuy (edited 05-22-2001).]
|
|
iMac 17" G4 800MHZ & 768 SDRAM
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Feb 2001
Status:
Offline
|
|
Did you set one of the text fields to be the initial first responder?
|
|
The 4 o'clock train will be a bus.
It will depart at 20 minutes to 5.
|
| |
|
|
|
 |
|
 |
|
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status:
Offline
|
|
Does it work in your built app as expected? If so, I'd suggest it's a bug in IB.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
I followed the tutorial step-by-step so I didn't set the First Responder. Nevertheless, I experimented by control dragging from the Initial Responder object to the first text field but I didn't know what to do next -tried a few possibilities but the behaviour was still the same. What should be the target action for the First Responder? Pardon my ignorance -I'm in diapers in regards to Objective-C.
Oh by the way, I the built the source code provided by Apple and the built app behaves exactly the same (odd) way that I describe above. Now, given that the tab just cycles through all text fields by default, I don't see the need for the nextKeyView. What could be wrong?
[This message has been edited by DaGuy (edited 05-22-2001).]
|
|
iMac 17" G4 800MHZ & 768 SDRAM
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Sep 2000
Status:
Offline
|
|
I don't have the answer to your question, just the opposite actually. I experienced the exact behavior you describe while walking through the tutorial step by step as well. I figured I must have done something wrong, and didnt worry about it at the time, as it seemed a small detail. It sounds like I was not at fault though, and you are not alone, in the occurance.
Anyway, just thought I'd share.
Spencer
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
I believe that nowadays all the nextKeyView/previousKeyView settings get automatically redone after the nib is loaded. There are private NSView methods that presumably do this (_setDefaultKeyViewLoop and _recursiveSetDefaultKeyViewLoop). I'm guessing this is done so that programmers don't have to painstakingly go through and connect all the views. Unfortunately it does mean that nextKeyView settings in IB are lost.
If you set nextKeyView/previousKeyView programmatically after the nib is loaded, I think those settings will stick, though I'm not completely sure. I don't know of any way to turn this feature off, and I don't know if/where this is documented either.
|
|
|
| |
|
|
|
 |
|
 |
|
Fresh-Faced Recruit
Join Date: Apr 2001
Status:
Offline
|
|
Did you set the third field's attributes so that it could not be edited? I get that behavior when I have the "Editable" checkbox selectd, but do not get the behavior you describe when the "Editable" checkbox is unselected.
wNkK5C
|
|
|
| |
|
|
|
 |
|
 |
|
Dedicated MacNNer
Join Date: Jan 2001
Location: Virginia, US
Status:
Offline
|
|
The editable thing is different. When a textfield is not editable, it won't accept first responder status, so it's not a "valid" key view. Using tab/backtab will skip over these views when moving between UI fields. See the -nextValidKeyView and -previousValidKeyView methods on the NSView class; they are used to determine the next key view when tabbing through fields.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Oct 2000
Location: Lawrence, KS
Status:
Offline
|
|
Althought far from tragic, IB is broken in this area -probably in many other places too. Good news is that there is an updated version of IB circulating at WWDC. Maybe we will get a chance to download it soon. Go check the URL below,
http://wwdc2001.stepwise.com/Special...C2001/401.html
[This message has been edited by DaGuy (edited 05-24-2001).]
|
|
iMac 17" G4 800MHZ & 768 SDRAM
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|