LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace CVI Built-in popup

I'm building several popups in CVI, which are used to replace build-in popups. I will call my custom popups in my CVI application. My difficulty, for example below, is I can not make execute following codes until my popup user interface is closed, That is to say, during showing my popup, the following code will be executed, AND I don't want this to happen.
 
    MyPopup();
    for (i=0; i<100; i++)
    {
     SetCtrlVal(panelHandle,PANEL_TESTPERCENT,i);
     Delay(0.1);
    }
 
 
Thanks!
Jacky
 
 
0 Kudos
Message 1 of 2
(2,940 Views)
Presumably, your MyPopup function just constructs the panel UI, installs callbacks on some controls, displays the panel, then returns.  This means that program execution continues back up the call stack (including the for loop from your example) until it reaches a message processing loop (like RunUserInterface, for example).  If you want to prevent MyPopup from returning before the popup is dismissed, you need to loop and process events within that function:

int gMyPopupRunning = 0;

void MyPopup(void)
{
    // ...
   gMyPopupRunnning = 1;
    while (gMyPopupRunning)
    {
        ProcessSystemEvents();
    }
}

Using the above code, any panel/contol callbacks you write that bring the panel down must also set this variable to 0.

Hope this helps.

Mert A.
National Instruments

0 Kudos
Message 2 of 2
(2,932 Views)