To determine whether the app is launching for the first time, you can put a boolean called "firstLaunch" into the user defaults. It would have a factory default of YES and could be changed to NO inside of applicationDidFinishLaunching:.

As for the buttons, are you sure you want to detect mouse events on them? Will setting their targets and actions, and possibly determining which button was clicked using the actions' "sender" arguments, not suffice? If not, I believe you will have to subclass NSButton to override the mouse event-handling methods.

Shlok Datye
Coding Turtle
http://codingturtle.com


On 26.05.2009, at 20:47, Walker Argendeli wrote:

Here's a simplification:

I have an application with several buttons. If it is the first time the application is launching, I want to do some special things. In my AppController class, which is a delegate of NSApp, I use the delegate method -applicationDidFinishLaunching: to perform the test. After I've detected that it is the first time, I first want to access some IBOutlets. Then, I'd like to be able to get mouse events for each button, so that I can do other things.

I can't figure out want to do with the classes. I'd like to make a new class (FirstLaunch) for the first launch, but I'm not sure what to call from AppDelegate. Also, to get mouse events, shouldn't I be a sublass of the buttons, and considering that I have multiple buttons, I'm confused. I could probably tackle these issues one-by- one, but taken all together, they're confusing me.

Broken down, I need to access & manipulate IBOutlets I have set in IB, determine when buttons are clicked (and which button was clicked). I'd like to be able to do this from another class so as to not clutter up the AppDelegate.

Thanks for the help!


- Walker Argendeli


_______________________________________________

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 arch...@mail-archive.com

Reply via email to