Link to home
Start Free TrialLog in
Avatar of gail_p
gail_p

asked on

Tracking a control in a dialog window

How do I track a dynamically created control in a dialog window.
I create a dialog and its controls from a DLOG resource. However  I need to add a
another control depending on a certain criteria. I am currently using
DialogSelect() and a switch() statement to handle the dialog. My problem
is when I create a new control how do I track the control if I
don't know the controls item number? I have included a brief summary of the code below:


myDialog = GetNewDialog(kMainDialog, wStorage, (DialogPtr)-1);
theControl = NewControl(myDialog, &menuRect, "\paPopUpMenu", popupTitleLeftJust, 128, 0, popupMenuProc, 0);


before calling

DialogSelect(&gEventRecord, &hitWindow, &itemHit);

if( hitWindow == myDialog) {
      switch(itemHit) {
                  case item1:
                  
                        break;
                  
                  case item2:
            
                        break;
                  
            
            
            }
}
Avatar of gail_p
gail_p

ASKER

I figured this would be an easy question but no one has answered it.

Please.
Maybe you can set an item not to your contorl when you create it:

SetDialogItem(myDialog,yourItemNo,btnCtrl,(Handle)theControl,&menuRect)
ASKER CERTIFIED SOLUTION
Avatar of Alex Curylo
Alex Curylo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial