• 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: NSButton with a delayed popup-menu?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButton with a delayed popup-menu?


  • Subject: Re: NSButton with a delayed popup-menu?
  • From: Stephane Sudre <email@hidden>
  • Date: Tue, 8 Nov 2005 16:01:24 +0100


On 8 nov. 05, at 14:04, Dix Lorenz wrote:

Hi,

how would I go about creating an NSButton like the Build-button (and others) in XCode? If the user just clicks it, it acts like a regular button, if he clicks and holds a menu pops up? Safari uses the same for it's back/forward button...

It looks like Safari is running a loop in the mouseDown: method and after a while if the mouse has never exited the button frame display the popup menu. (Mac OS X 10.3.9).


Maybe it could be better implemented to:

* not block all the UI as in Safari when the button is pushed

* allow the PopupButton to be displayed when you have exited one time the button frame with the mouse button down and then re-entered the button frame.

This would require using the mouseDown: mouseUp and mouseDragged:. Something like this:

1. mouseDown:

. render the button highlighted
. delay the apparition of the popup menu with:

- (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay;

2. mouseDragged:

. If the mouse cursor is outside the button frame and was previously inside

=> cancel the Perform request
=> render the button normal state

. If the mouse cursor is inside the button frame and was previously inside

=> render the button highlighted
=> delay the apparition of the popup menu

3. mouseUp:

. cancel the Perform request

. launch the standard action.

The delayed method would popup the menu.

Now what would be interesting to see is whether the mouseUp: method of the button class is going to be called when you select an item from the menu.

My $0.02

_______________________________________________
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: NSButton with a delayed popup-menu?
      • From: Dix Lorenz <email@hidden>
References: 
 >NSButton with a delayed popup-menu? (From: Dix Lorenz <email@hidden>)

  • Prev by Date: Re: I've ported Moire to MacOS X, what do you think of it?
  • Next by Date: Problems with NSURLConnection and NSString
  • Previous by thread: NSButton with a delayed popup-menu?
  • Next by thread: Re: NSButton with a delayed popup-menu?
  • Index(es):
    • Date
    • Thread