Opening a Panel

2008-06-27 Thread Alex Wait
Been working my way through the Hillegass book.

I'm on the chapter where you usea a Panel window and I am having some
trouble. I did all the instructions to the letter (as best as I can tell ^_^
)
and when my program runs, the Preferences menu item is grayed out. I checked
to make sure it was "Enabled" and it is.

Is there some property I need to set?

-- 
If you can't be kind, at least have the decency to be vague.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Sherm Pendley
On Fri, Jun 27, 2008 at 7:31 PM, Alex Wait <[EMAIL PROTECTED]> wrote:
> Been working my way through the Hillegass book.

I don't have the book (sorry Aaron, I'm poor...) so I'll to talk in
generalities.

> I'm on the chapter where you usea a Panel window and I am having some
> trouble. I did all the instructions to the letter (as best as I can tell ^_^
> )
> and when my program runs, the Preferences menu item is grayed out. I checked
> to make sure it was "Enabled" and it is.
>
> Is there some property I need to set?

First, check to make sure the menu item is connected correctly in IB.
Make note of the action name. Then check to be sure that the correct
action is implemented in your controller. A menu item is automagically
disabled when the specified action method can't be found, so a simple
typo is often the culprit for problems like this.

sherm--

>
> --
> If you can't be kind, at least have the decency to be vague.
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> 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/sherm.pendley%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>



-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Ken Thomases

On Jun 27, 2008, at 6:31 PM, Alex Wait wrote:

and when my program runs, the Preferences menu item is grayed out.  
I checked

to make sure it was "Enabled" and it is.

Is there some property I need to set?


By default, Cocoa automatically enables/disables menu items.  It does  
this based on their target and action.  If the target implements the  
action, then the menu is enabled; if not, it's disabled.  If the  
target is First Responder (i.e. nil), then Cocoa scans the responder  
chain for an object that responds to the action.  If it finds one,  
the menu item is enabled; otherwise, it's disabled.


So, double-check that you've set the menu item's action.  If it's  
connected to a specific target object, make sure that object responds  
to that selector.  (Check spelling and case!)  If it's connected to  
First Responder, make sure that something in the responder chain  
responds.  For a Preferences menu, it's usually the application  
delegate/controller or the application object which would ultimately  
respond.  If you have an object which is supposed to be the  
application delegate, make sure it really is.  That's often  
accomplished by instantiating the delegate in the main nib and  
connecting the application's delegate outlet to it.


Cheers,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Alex Wait
apologies to all ;)

I had misspelled my action's name. I am still getting used to Obj C and it's
ability to compile methods that haven't been declared. :)

On Fri, Jun 27, 2008 at 6:15 PM, Ken Thomases <[EMAIL PROTECTED]> wrote:

> On Jun 27, 2008, at 6:31 PM, Alex Wait wrote:
>
>  and when my program runs, the Preferences menu item is grayed out. I
>> checked
>> to make sure it was "Enabled" and it is.
>>
>> Is there some property I need to set?
>>
>
> By default, Cocoa automatically enables/disables menu items.  It does this
> based on their target and action.  If the target implements the action, then
> the menu is enabled; if not, it's disabled.  If the target is First
> Responder (i.e. nil), then Cocoa scans the responder chain for an object
> that responds to the action.  If it finds one, the menu item is enabled;
> otherwise, it's disabled.
>
> So, double-check that you've set the menu item's action.  If it's connected
> to a specific target object, make sure that object responds to that
> selector.  (Check spelling and case!)  If it's connected to First Responder,
> make sure that something in the responder chain responds.  For a Preferences
> menu, it's usually the application delegate/controller or the application
> object which would ultimately respond.  If you have an object which is
> supposed to be the application delegate, make sure it really is.  That's
> often accomplished by instantiating the delegate in the main nib and
> connecting the application's delegate outlet to it.
>
> Cheers,
> Ken
>
>


-- 
If you can't be kind, at least have the decency to be vague.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Kyle Sluder
On Fri, Jun 27, 2008 at 10:01 PM, Alex Wait <[EMAIL PROTECTED]> wrote:
> I had misspelled my action's name. I am still getting used to Obj C and it's
> ability to compile methods that haven't been declared. :)

You haven't specified what was misspelled (just the implementation or
the interface declaration as well) so I'll point out the following: if
you declare that instances of your class respond to -foo in the
@interface block, but then in your @implementation block do not define
-foo (through misspelling or negligence) then the compiler should warn
you that you have an incomplete class definition.  Always heed this
warning.  In fact, always heed all warnings.  Of course, if you didn't
specify -foo in your class's interface, you won't get this message.

If the problem was in your nib, IB may be able to warn you that you
specified an incorrect action.  If you directly connect a view to a
target and specify an action that the object doesn't claim to respond
to (again, misspelling or neglecting to type the action as IBAction
are the most common culprits) then IB will throw up a warning.  But if
you connect the view to First Responder, IB has no idea what objects
are in the responder chain and can't provide this helpful warning.

The point I'm trying to make is to always heed warnings and fix them.
As a beginner, in particular, you should probably turn on "Treat
Warnings as Errors" in your target settings, so that you can't ignore
compiler warnings.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Opening a Panel

2008-06-27 Thread Alex Wait
I misspelled preference.

And yeah. Xcode was telling me of my mistake. :)

On Fri, Jun 27, 2008 at 7:24 PM, Kyle Sluder <
[EMAIL PROTECTED] <[EMAIL PROTECTED]>> wrote:

> On Fri, Jun 27, 2008 at 10:01 PM, Alex Wait <[EMAIL PROTECTED]> wrote:
> > I had misspelled my action's name. I am still getting used to Obj C and
> it's
> > ability to compile methods that haven't been declared. :)
>
> You haven't specified what was misspelled (just the implementation or
> the interface declaration as well) so I'll point out the following: if
> you declare that instances of your class respond to -foo in the
> @interface block, but then in your @implementation block do not define
> -foo (through misspelling or negligence) then the compiler should warn
> you that you have an incomplete class definition.  Always heed this
> warning.  In fact, always heed all warnings.  Of course, if you didn't
> specify -foo in your class's interface, you won't get this message.
>
> If the problem was in your nib, IB may be able to warn you that you
> specified an incorrect action.  If you directly connect a view to a
> target and specify an action that the object doesn't claim to respond
> to (again, misspelling or neglecting to type the action as IBAction
> are the most common culprits) then IB will throw up a warning.  But if
> you connect the view to First Responder, IB has no idea what objects
> are in the responder chain and can't provide this helpful warning.
>
> The point I'm trying to make is to always heed warnings and fix them.
> As a beginner, in particular, you should probably turn on "Treat
> Warnings as Errors" in your target settings, so that you can't ignore
> compiler warnings.
>
> --Kyle Sluder
>



-- 
If you can't be kind, at least have the decency to be vague.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]