From: Bryan Pietrzak <email@hidden>
To: Jesse Carpenter <email@hidden>
CC: email@hidden, email@hidden
Subject: Re: Popup Button not behaving as expected
Date: Sun, 30 Jan 2005 00:18:10 -0600
On Jan 29, 2005, at 11:45 PM, Jesse Carpenter wrote:
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
OK, so you're talking about stuff from what? 15 years ago? :)
You know if you adopted modern carbon approaches, things in general might
be easier ;)
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.
What is the control's maximum? Did you remember to set it to the number of
items in the menu? That's a common mistake. (And this mistake hasn't
changed in ten years either ;)
This has worked using pre-Mac OS.
What? On the Apple IIGS ? ;)
Bryan