Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Popup Button not behaving as expected



On 1/30/05 12:45 AM, Jesse Carpenter didst favor us with:

> There was a time when life was simpler....but using the Appearance Manager.
> Well!
> 
> I created a window using GetNewCWindow()...OK
> 
> Then I created Popup Control by calling GetNewControl()...OK
> 
> Upon contentClick by the Event, I use the following code:
> 
> static void PopupControl(WindowRef pWindow, EventRecord *pEvent)
> {
> Point mouse;
> ControlRef theControl;
> SInt16 part;
> 
> DoSomeProcessing();
> 
> mouse = pEvent->where;
> GlobalToLocal(&mouse);
> theControl = FindControlUnderMouse(mouse, pWindow, &part);
> if (HandleControlClick(theControl, mouse, pEvent->modifiers,
> (ControlActionUPP) -1)) {
> short value = GetControlValue(theControl);
> etc.
> }
> }
> 
> The tracking works well but the selection in the menu always returns to the
> top of the list. It would not show the menu selection chosen after releasing
> the mouse button, thus returning to a value of one.
> 
> This has worked using pre-Mac OS.
> 
> Any suggestions will be appreciated.

This is almost always caused by adding items to the menu after the control
is created, and not setting the max of the control to the number of items in
the menu (or greater). If that's not it, then the other thing to look for is
a CarbonEvent handler (usually on the window or application) that's
returning noErr for events it doesn't handle.

Larry

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden

References: 
 >Popup Button not behaving as expected (From: "Jesse Carpenter" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.