• 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: NSSlider's mouseDown implementation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSSlider's mouseDown implementation


  • Subject: Re: NSSlider's mouseDown implementation
  • From: email@hidden
  • Date: Tue, 11 Jun 2002 08:14:51 -0500

Well if you are planning on using an NSMenu, or something with just text menu items, you should use NSStatusItem's setMenu message. In this case, you would forgo using the custom view entirely. On the other hand if you want to be more complicated and have a menu with something like a slider in it, then you will need to override NSView's mouseDown message. In your implementation, you will need to write your own event loop to handle the events. See the apple docs for more info on this and a good sample event loop to start with.
Thomas Marschall
On Monday, June 10, 2002, at 11:48 PM, Sanford Selznick wrote:

Wow, that is seriously informative. Thanks!!! Now if only I could figure out how to get the menu to appear too. ;-)

The NSMenu's popUpContextMenu doesn't quite work right if I set the point argument to just below the menubar.

If I can figure this part out, I can get rid of my NSMenuExtra (gladly) completely.

You've been so helpful, I feel bad asking. But any ideas?

Thank you,
Sanford

At 11:38 PM -0500 6/10/02 email@hidden wrote:
If you draw your custom view in the status bar(or anywhere else), the aqua window pattern will show through it. To highlight it, call this method:
[[NSColor colorWithDeviceRed:.2 green:.4 blue:.8 alpha:1] set];
then:
NSRectFillUsingOperation([imageView frame], NSCompositePlusLighter);
where imageView is the custom view that you are working with.
If you are really picky you can tweak the color a little to have it match the true system highlight color. There should be a way to figure it out programaticly, but I don't know that much about color math. There is a method to find the standard highlight color, which is what should be used.
more info on NSRectFillUsingOperation can be found at
http://developer.apple.com/techpubs/macosx/Cocoa/Reference/ApplicationKit/
ObjC_classic/Functions/AppKitFunctions.html#BAJJABBF

On Monday, June 10, 2002, at 03:43 PM, Sanford Selznick wrote:

Hello,
I saw your message where you were writing a custom NSStatusItem. I'm doing the same now too. If I may ask, you create your own NSView for the NSStatusItem. How does one draw the menu with the blue background and show the menu itself? It appears that creating an NSView overrides both drawing /and/ behavior. I can't help but feel that I'm missing something obvious.

Thanks,
Sanford
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: Current process
  • Next by Date: newbie trouble with multiple nibs, menu's, runmodalforwindow and pasting
  • Previous by thread: Re: NSSlider's mouseDown implementation
  • Next by thread: Re: NSSlider's mouseDown implementation
  • Index(es):
    • Date
    • Thread