Re: Interface item validation through first responder
Re: Interface item validation through first responder
- Subject: Re: Interface item validation through first responder
- From: Luc Van Bogaert <email@hidden>
- Date: Wed, 15 Jun 2011 16:59:34 +0200
Laurent,
I'm sorry I haven't been any clearer, but that's exactly what I am doing: I have designed two seperate views in IB, but I'm instantiating each of them with a view controller (and adding them to the content pane) in code.
So, even though I have two nib files in IB, I'm assuming I can not use IB to reference the actual view objects contained in the nibs as the target for my user interface items such as menu items and buttons. So, I decided to target "first responder" instead, which initially worked well, but now seems to be broken after adding an extra view with textfields to the content pane. It seems that the extra view and textfields have somehow broken the mechanism of the responder chain to which the two other views belong.
I'm obviously missing something here, and hoping someone can point me in the right direction.
--
Luc Van Bogaert
On 14 Jun 2011, at 22:36, Laurent Daudelin wrote:
> You can still design views in IB that you set as the content view of windows at runtime.
>
> -Laurent.
> --
> Laurent Daudelin
> AIM/iChat/Skype:LaurentDaudelin http://www.nemesys-soft.com/
> Logiciels Nemesys Software email@hidden
>
> On Jun 14, 2011, at 13:20, Luc Van Bogaert wrote:
>
>> Hi,
>>
>> I'm hoping someone could provide some help solving the difficulties I'm facing with validation of user interface items. The problem is caused by my current GUI design, which is as follows:
>>
>> The contentview of my main window is designed to contain one of two different views, to be selected by the user at runtime. So the view controllers are not instantiated in IB, but rather in code during runtime.
>>
>> All the menu items and buttons in the interface use the target-action mechanism, but because of the previous design decision, I am targetting the "first responder" object instead of the actual view controller objects. When the user switches views held by the main window, I'm making sure the selected view also becomes first responder. So far so good.
>>
>> But now a problem comes up when adding another view to the interface. As this extra view contains some textfields, selecting one of the text fields makes it first responder, which in turn breaks my interface item validation, because now the targetted actions can no longer be found as part of the active first responder object.
>>
>> So, I seem to be forced to implement all my action methods in the AppDelegate instead of in my view controllers, or is there some better way to solve this problem?
>>
>> --
>> Luc Van Bogaert
>> http://users.skynet.be/luc.van.bogaert
>>
>>
>>
>>
>> _______________________________________________
>>
>> Cocoa-dev mailing list (email@hidden)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>>
>> This email sent to email@hidden
>
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden