Solved

trackcontrol problem with pop-up menu

Posted on 1998-09-05
1
240 Views
Last Modified: 2013-12-26
I thought that TrackControl took care of displaying the associated menu when a mousedown event occured in the control.

popDownHdl = GetNewControl( 130, myWindow); // System 7 pop-up

      switch (FindWindow(myEvent.where,&hitWindow))      {
                                    case inContent:
                                    
                                          GlobalToLocal(&myEvent.where);
                                          hitControl=FindControl(myEvent.where,myWindow,&hitControlHdl);
                                        if(hitControlHdl == popDownHdl)
                                          {      Handle selection
        }
0
Comment
Question by:dwp090598
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
boonstra earned 50 total points
ID: 1291521
TrackControl does take care of displaying the menu when a mouseDown occurs.  The code snippet below works properly.  Things to check: (1) is your popDownHandle nil, (2) does your popup control have the correct procID (1008), (3) is the menu properly associated with the control ((**popDownHandle).contrlMin == menuID, or (4) are you sending the correct actionProc value to TrackControl (should be -1),

Working snippet:

ControlHandle popDownHandle;
.
      popDownHandle = GetNewControl(130, gWindow);
      if (popDownHandle==nil) DebugStr("\p nil control handle");
.

static void DoPopupMenu(Point pt,ControlHandle ctl)
{
      short part,menuItem;
      part = TrackControl(ctl,pt,(ControlActionUPP)-1);
      menuItem = GetControlValue(ctl);
      /* process menu selection */
}

static int DoMouse(EventRecord *ev)
{
      WindowPtr wind;
      short part;
      int res = 0;

      part = FindWindow(ev->where, &wind);
            
      switch (part) {
            case inContent:
            {
                  ControlHandle theControl;
                  int part;
                  Point pt;
                  pt = ev->where;
                  GlobalToLocal(&pt);
                  part = FindControl(pt, wind, &theControl);
                  if (theControl==popDownHandle) {
                        DoPopupMenu(pt,theControl);
                  }
                  break;
            }
                  
      }
      
      return res;
}

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
lucky13 challenge 11 158
child constructor and parent constructor, overriding and overloading 6 93
Craigslist Software for Windows Computer 9 105
Need a really cheap CRM 5 141
Before we dive into the marketing strategies involved with creating an effective homepage, it’s crucial that EE members know what a homepage is. In essence, a homepage is the introductory, or default page, of a website that typically highlights the …
Online promotion is consistently becoming more important for all types of businesses. From Facebook ads to search engines to YouTube videos, there are all sorts of channels that can effectively be used to promote a business or product. But how shoul…
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question