• 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: How to position a window under a button of another window?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to position a window under a button of another window?


  • Subject: Re: How to position a window under a button of another window?
  • From: "Justin R. Miller" <email@hidden>
  • Date: Tue, 17 Apr 2007 08:54:31 -0400

The way I did this was to have an NSButton (prefsPullDownButton) that I wanted people to click and an NSPopupButton (prefsPopUpButton) hidden underneath it (in IB) with an attached popup menu.

I set the top button to "stick" on left click:

[prefsPullDownButton sendActionOn:NSLeftMouseDownMask];

And I wired its action to this:

- (IBAction)clickedPrefsPullDown:(id)sender
{
[[prefsPopUpButton cell] performClickWithFrame:[sender frame] inView:[sender superview]];
}


That passes the click along to the bottom button, but showed its popup menu under the original, top button.

It looked like this:

http://codesorcery.net/wp-content/uploads/oldprefs.png

Is that what you're talking about? The menu would stay up until the button was clicked again.

Hope that helps,

JM

On Apr 17, 2007, at 6:21 AM, Mike Zornek wrote:

I'm trying to implement a date picker popup ui, something like this web
variant:


http://www.nsftools.com/tips/DatePickerTest.htm

I have a button hooked up to a controller action. The controller has an
outlet to the popupPanel and obviously has the original button as the
sender.


Is there a way I can ask the sender (the button) for it's position on screen
and then set the panel to be just under the button? Eventually I'll also
want to sniff the location to make sure there is in fact room underneath and
if not position it above but I'm having trouble even getting started.


Any suggestions?

A sample project that I've started is here:

http://mikezornek.com/temp/FriendManager.zip

~ Mike

_______________________________________________

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:
40codesorcery.net


This email sent to email@hidden


-- Justin R. Miller Code Sorcery Workshop http://codesorcery.net


_______________________________________________

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


References: 
 >How to position a window under a button of another window? (From: Mike Zornek <email@hidden>)

  • Prev by Date: NYC Cocoaheads meeting
  • Next by Date: Re: How to position a window under a button of another window?
  • Previous by thread: Re: How to position a window under a button of another window?
  • Next by thread: Re: How to position a window under a button of another window?
  • Index(es):
    • Date
    • Thread