• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
RE: NSApplicationMain() doesn't set NSApp to my subclass
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: NSApplicationMain() doesn't set NSApp to my subclass


  • Subject: RE: NSApplicationMain() doesn't set NSApp to my subclass
  • From: "Christopher Hickman" <email@hidden>
  • Date: Wed, 17 Aug 2005 16:29:40 -0400

Okay, it turns out that it is correctly setting NSApp to an instance of my
subclass.  I only thought it wasn't because the backtrace was showing
-[NSApplication run] and not -[SWLApplication run].  I guess that's because
I didn't need to override the super's implementation of run.  The other
reason I thought it wasn't working was that the point of me subclassing
NSApplication was to take the NSScrollWheel events and pass them off to
another object, so that scroll wheel events would be application-global.  It
isn't working.  Even though my NSApp object implements scrollWheel:, it is
never called when the scroll wheel scrolls.

Am I going about this wrong?  Here's what I want to happen.

When my app is active, and the scroll wheel is moved (regardless of the
mouse location), I want to take that event and route it to a slider in my
interface.  What I have done now (which doesn't work, remember) is subclass
NSApplication and implement scrollWheel: such that it just takes theEvent
and calls [mySlider scrollWheel:theEvent].  It is *never* called.  Perhaps
this is a bug and this is the same reason that the on scroll wheel handler
is never called when it is connected to the application object in
AppleScript Studio (the situation I'm trying to workaround with ObjC).

Again, any hints are appreciated.

Thanks,
Topher

-----Original Message-----
From: cocoa-dev-bounces+tophu=email@hidden
[mailto:cocoa-dev-bounces+tophu=email@hidden] On Behalf Of
Christopher Hickman
Sent: Wednesday, August 17, 2005 4:03 PM
To: email@hidden
Subject: NSApplicationMain() doesn't set NSApp to my subclass

I have an app with a subclass of NSApplication, called SWLApplication.  I've
set the custom class of File's Owner in MainMenu.nib to my subclass and I've
changed my principal class to SWLApplication in my application's target in
Xcode, but when I run my app NSApplicationMain() doesn't initialize the
NSApp global with an instance of my subclass.  Instead, NSApp is an
NSApplication instance.

Am I missing a step somewhere?

Any hints are appreciated.

Thanks,
Topher


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSApplicationMain() doesn't set NSApp to my subclass
      • From: glenn andreas <email@hidden>
References: 
 >NSApplicationMain() doesn't set NSApp to my subclass (From: "Christopher Hickman" <email@hidden>)

  • Prev by Date: Setting default font for NSTextView in IB?
  • Next by Date: Re: Want to get filename for images dragged from Finder and from Safari / Firefox
  • Previous by thread: NSApplicationMain() doesn't set NSApp to my subclass
  • Next by thread: Re: NSApplicationMain() doesn't set NSApp to my subclass
  • Index(es):
    • Date
    • Thread