If you have to display a panel and wait for the user to click one button to proceed, you could use GetUserEvent ().
I use it when I have to disply a popup panel
different from MessagePopup or PrompPopup or similar and I don't want to deal with a separate callback to manage controls on that panel. Here you find an example: I display a popup for the user to input a password (using the password control in toolbox to display an input string with the usual '*****' pattern while typing).
pwH = LoadPanel (0, UIR, pwd);
InstallPopup (pwH);
PasswordCtrl_ConvertFromString (pwH, pwd_pw);
errChk (PasswordCtrl_SetAttribute (pwH, pwd_pw, ATTR_PASSWORD_MAX_LENGTH, 12);
while (TRUE) {
GetUserEvent (1, &pnl, &ctrl); // Program waits until a button pressed
// Here when a button
have been pressed
if (ctrl == pwd_quit) { // 'Abort'
button
// Exit from function, close popup...
}
PasswordCtrl_GetAttribute (pnl, pwd_pw, ATTR_PASSWORD_VAL, pw); // Read password
if (strcmp (pw, correct_password))
MessagePopup ("PASSWORD",
"Incorrect password. Retry.");
else
break; // Correct password
}
RemovePopup (0);
I use it where I don't want to exit from the actual function to manage the 'Ok' button from the popup panel elsewhere.
Hope this helps