LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Wait for user to select the OK button

Solved!
Go to solution

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.

 

 

0 Kudos
Message 1 of 6
(3,638 Views)

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 6
(3,635 Views)

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 );
        }

0 Kudos
Message 3 of 6
(3,630 Views)

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.

 

0 Kudos
Message 4 of 6
(3,626 Views)
Solution
Accepted by topic author jwinterb

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.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 5 of 6
(3,620 Views)

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.

 

0 Kudos
Message 6 of 6
(3,613 Views)