• 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
MouseMoved Events, Window Activation, Borderless Windows, and Panels :(
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

MouseMoved Events, Window Activation, Borderless Windows, and Panels :(


  • Subject: MouseMoved Events, Window Activation, Borderless Windows, and Panels :(
  • From: Seth Willits <email@hidden>
  • Date: Mon, 26 Mar 2007 15:21:51 -0700

Good grief!


I've been trying to come up with _any_ solution for some fancy window shinnanigans and nothing is working for everything. Every time I plug up hole, a problem pops out of another. It's like whack-a-mole while squeezing jello.



In my program there is one window that is and (currently) fullscreen, and the other is small borderless floating window that has an all- custom UI containing controls which manipulate the fullscreen window. (Think QuickTime's new movie controls, except the controls are in a separate window.) Both windows are NSPanel subclasses so that they don't show up in Exposé (seeing as how I can't control this any other way!!), and both need mouse moved events to do some rollover effects. Furthermore, neither window should have to be clicked on first to activate it, then clicked again to click on whatever control the click was intended for. And as a little added bonus, the fullscreen window should always be the key window unless a certain text field in the floating window is being used.



So there are a few things that are easy or relatively easy to do.
1) making NSPanel subclasses, one full, one small, both custom UIs: no brainer (setFloatingPanel:YES to keep them out of Exposé)
2) making the smaller panel always float in front of the other: no brainer (just use setLevel:)
3) making the fullscreen window always key: pretty simple. Use setBecomesKeyOnlyWhenNeeded:YES, and when the text field ends editing, make sure to call makeKeyAndOrderFront: on some other window. Also implement - (BOOL)acceptsFirstMouse:(NSEvent *) theEvent; { return YES; } in all of the views in the window;



Now here's where the problem is:

Accepting mouse moved events in each window is easy when the window is key. You just set a first responder (not sure why) then setAcceptsMouseMovedEvents:YES and add mouseMoved: to the view. Works dandily, except the window must be key in order to get the events. Now in my case, I want to get the mouseMoved events for the non-key smaller floating window to do rollovers. Solving this is proving to be really tricky. I've overrided sendEvent in a number of areas and tried to determine where the mouse is and know which window to send the event to from an NSApplication subclass, but this is much more difficult than you'd think because there's NO WAY to get an ordered list of _ALL_ windows in an application (including NSPanels)!!! If there was, it would be really easy to put together. So I'm stuck on this.

Now I can live without the mouseMoved event in the non-key smaller window, but there's still another problem, one that's really annoying. If you display both windows, and the fullscreen window is key, and then you click on a button in the smaller window (remembering that it does not become key unless needed), the mouseMoved events STOP getting sent to the fullscreen window UNTIL you CLICK on the main window again or call makeKeyAndOrderFront:. What's up with that? I can easily call it from every action in the smaller window, but I'd like to not have to know about the other window at all. :\ (I'd like to not have to call makeKeyAndOrderFront: after ending editing in the text field as well).


Any thoughts? I guess mostly my problem is the mouseMoved events in the non-key window. What can I do about that?




Here's a project with all of the code minus the mouseMoved when the window is non-key.
(Windows are not borderless so you can see when the are key or not)
http://www.freaksw.com/temp/WindowTestsStarter.zip




Thanks a million,


-- Seth Willits



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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


  • Follow-Ups:
    • Re: MouseMoved Events, Window Activation, Borderless Windows, and Panels :(
      • From: Ricky Sharp <email@hidden>
  • Prev by Date: Re: "save as" in a document based app
  • Next by Date: Re: "save as" in a document based app
  • Previous by thread: NSExpressionType and BNF definition of predicates
  • Next by thread: Re: MouseMoved Events, Window Activation, Borderless Windows, and Panels :(
  • Index(es):
    • Date
    • Thread