01-04-2012 11:17 AM
For my application I cannot use a simple MessagePopup where the user must select the OK button to continue.
I created a new panel with just a text message and an OK button to act like a MessagePopup.
When I call InstallPopup and the Panel box pops up I want to wait until the user selects OK before continuing just like the MessagePopup.
How can I accomplish this?
Thanks!
John W.
Solved! Go to Solution.
01-04-2012 11:28 AM
You can use GetUserEvent () function. In the scenario you have depicted you must have all controls in the popup panel set as "Normal" and only the OK button set as "Hot" (The default control mode). The callback the must handle the panel can be structured like this:
int pnl, ctl, handle; // some code here // Code to handle the popup handle = LoadPanel (.....) InstallPopup (handle); GetUserEvent (1, &pnl, &ctl); // Wait for the user to press OK button DiscardPanel (handle); // The rest of the code here
This help topic gives you additional informations on this subject.
01-04-2012 11:44 AM
In addition to Roberto's answer: if you happen to have several 'hot' controls you can use a while loop where you check for the correct panel and control id, something like:
while ( ( panel_handle != text_message_panel_handle ) && ( control_id != ok_button_control ) )
{
GetUserEvent ( 1, &panel_handle, &control_id );
}
01-04-2012 12:30 PM
Thanks, that worked great!
One more question, when the panel pops up and is waiting for me to press the OK button the mouse is an hourglass instead of the usual pointer. I can still select the OK button with the hourglass mouse, but is there a way to get the mouse to be the regular pointer while waiting for the OK button to be pressed?
Thanks
John W.
01-04-2012 03:25 PM - edited 01-04-2012 03:25 PM
The popup has no effect on the mouse cursor: may it happen that you have some function that manipulates the cursor before the popup is shown? A SetWaitCursor (1); would be enough.
01-04-2012 03:36 PM
Yep, that was it. The SetWaitCursor(1) was called earlier in the program. I took this project over from someone who left the company and I did not see this being done earlier in the program.
Thanks for your help!
John W.