FROM : Cathy Shive
DATE : Fri Jul 04 08:54:59 2008
Hi Wayne,
One way you could do this is to connect the control to the "First
Responder" object in Interface Builder, instead of to the "File's
Owner". This means that when the action is triggered, it will go to
the window's first responder (probably the view at that point), and
then move through the responder chain until it finds an object that
implements the action method. If you implement the action method in
your App Delegate class, instead of your view, it will receive the
action.
Click on "First Responder" in your nib and add the action to its list
of actions in the inspector window (in the identity tab). Then
connect the control to the "First Responder" object as the target and
select the method you added as the action.
Best,
Cathy
On Jul 4, 2008, at 4:02 AM, Wayne Pascoe wrote:
> Hi all,
>
> I think I've hacked myself into a corner and I could use some
> advice / clarity in getting out of it.
>
> I am trying to build a tool that uses multiple views inside one
> window as well as additional windows when appropriate.
>
> The code for changing between views (changeViewController and
> displayViewController) lives in the App Delegate class. This class
> has the outlet to the window that all the views are shown in. This
> class is also the delegate for the File's Owner in my main menu nib.
>
> I then have NIBs for each different view. Each NIB has a
> corresponding viewcontroller class which is the class for the File's
> Owner of that NIB.
>
> When the application launches an initial view is loaded and
> displayed in the window from within the App Delegate class. The
> problem I then have is that I can't work out how to change to
> another view. Any methods I try and use are sent to the
> viewcontroller class for that view and not the App Delegate.
>
> The examples that I started out from all used a control outside of
> the view. For example, the view was loaded into a box in the window,
> and outside that box was an NSPopUp that you could use to switch
> views. I understand how this works, as this control sends messages
> to the App Delegate. This then has the code to change the view, and
> it also has the outlet to the window and the box, so it can update
> these.
>
> Is there a way for the viewcontroller class to receive the change
> view request from the user and forward that to the App delegate
> class? Or is this the wrong way to do it?
>
> Any pointers to reading on the correct way to do this would be
> greatly appreciated!
>
> Thanks,
> --
> Wayne Pascoe (gpg --keyserver www.co.uk.pgp.net --recv-keys
> 79A7C870)
> Hanlon's Razor:
> Never attribute to malice that which is adequately
> explained by stupidity
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Fri Jul 04 08:54:59 2008
Hi Wayne,
One way you could do this is to connect the control to the "First
Responder" object in Interface Builder, instead of to the "File's
Owner". This means that when the action is triggered, it will go to
the window's first responder (probably the view at that point), and
then move through the responder chain until it finds an object that
implements the action method. If you implement the action method in
your App Delegate class, instead of your view, it will receive the
action.
Click on "First Responder" in your nib and add the action to its list
of actions in the inspector window (in the identity tab). Then
connect the control to the "First Responder" object as the target and
select the method you added as the action.
Best,
Cathy
On Jul 4, 2008, at 4:02 AM, Wayne Pascoe wrote:
> Hi all,
>
> I think I've hacked myself into a corner and I could use some
> advice / clarity in getting out of it.
>
> I am trying to build a tool that uses multiple views inside one
> window as well as additional windows when appropriate.
>
> The code for changing between views (changeViewController and
> displayViewController) lives in the App Delegate class. This class
> has the outlet to the window that all the views are shown in. This
> class is also the delegate for the File's Owner in my main menu nib.
>
> I then have NIBs for each different view. Each NIB has a
> corresponding viewcontroller class which is the class for the File's
> Owner of that NIB.
>
> When the application launches an initial view is loaded and
> displayed in the window from within the App Delegate class. The
> problem I then have is that I can't work out how to change to
> another view. Any methods I try and use are sent to the
> viewcontroller class for that view and not the App Delegate.
>
> The examples that I started out from all used a control outside of
> the view. For example, the view was loaded into a box in the window,
> and outside that box was an NSPopUp that you could use to switch
> views. I understand how this works, as this control sends messages
> to the App Delegate. This then has the code to change the view, and
> it also has the outlet to the window and the box, so it can update
> these.
>
> Is there a way for the viewcontroller class to receive the change
> view request from the user and forward that to the App delegate
> class? Or is this the wrong way to do it?
>
> Any pointers to reading on the correct way to do this would be
> greatly appreciated!
>
> Thanks,
> --
> Wayne Pascoe (gpg --keyserver www.co.uk.pgp.net --recv-keys
> 79A7C870)
> Hanlon's Razor:
> Never attribute to malice that which is adequately
> explained by stupidity
>
> _______________________________________________
>
> Cocoa-dev mailing list (<email_removed>)
>
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| Wayne Pascoe | Jul 4, 04:02 | |
| Cathy Shive | Jul 4, 08:54 |






Cocoa mail archive

