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;
}
}
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
if( hitWindow == myDialog) {
switch(itemHit) {
case item1:
break;
case item2:
break;
}
}
Maybe you can set an item not to your contorl when you create it:
SetDialogItem(myDialog,you rItemNo,bt nCtrl,(Han dle)theCon trol,&menu Rect)
SetDialogItem(myDialog,you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Please.