One posible solution is to use:
GetUserEvent (1, &pnl, &ctrl);
The GetuserEvent can wait for a user input if you set the first parameter to '1', that way halting you program flow. Other threads or a timer will continue to be executed.
To use it you will need to do the folowing:
LoadPanel ()
InstallPopup ()
GetUserEvent ()
DiscardPanel ()
Process user input (if any) and continue your program.
The only disadvantage to this function is that it returns on ANY commit event generate by the user; this means that:
1. either you can set all controls on the popup panel as 'normal' instead of 'hot' (leave at least one hot control for the user to close the panel)
2. or you must enclose your GetUserEvent in a loop and process the ctrl parameter in order
to discriminate if to proceed or not.
An example of the second option (processing a simple panel with a password control, an 'OK' button and an 'abort' button):
InstallPopup ()
while (TRUE) {
GetUserEvent (1, &pnl, &ctrl);
if (ctrl == pwd_quit) goto Error; // User pressed the 'abort' button
errChk (PasswordCtrl_GetAttribute (pnl, pwd_pw, ATTR_PASSWORD_VAL, pw));
if (strcmp (pw, cg.pw))
MessagePopup ("Password", "Wrong password.");
else
break; // Correct password: exit while loop
}
This solution prevents you to work on multithreading due this problem only, it's simple and it works quite well.
Hope this helps
Roberto