LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I load a panel, Run User Interface, and continue running more code?

I have a dll that I have written, and I want one of the function calls to load a panel, have the RunUserInterface running to handle that panels events, and then continue with more code.

function()
{
LoadPanel()
RunUserInterface();
code();
code();
etc();
}

I know the example wont work, but how do I achieve the same result.

Ive tried calling RunUserInterface as another thread, but this doesnt seem to work either.

Regards

Alex.
Message 1 of 4
(3,760 Views)
Hello

RunUserInterface() starts a message loop which does not return until you call QuitUserInterface(). So Any code placed after RunUserInterface() will only run after after the message loop is completed.
Calling RunUserInterface() in another will only create a message loop in that thread. In which case, the UI in the main thread will not do anything, since you wont have a message loop in the main thread.
If all you need is to run some function after your message loop has initialized, Use one of the thread pool functions to schedule your code() in another thread. You can use CmtScheduleThreadPoolFunction() for that.

If you code() has some panel initialization, you can create callbacks for the panel and call code() there instead of scheduling it in a threa
dpool.

Hope this helps

Bilal Durrani
NI
Bilal Durrani
NI
0 Kudos
Message 2 of 4
(3,760 Views)
Thanks,

Sorta helped, I couldn't quite do what you suggested as I need the funtion to exit but keep RunUserInterface running. What I ended up doing was to call a thread that loaded the panel and ran the RunUserInterface, and then continued my code after the thread call.

Regards

Alex.
0 Kudos
Message 3 of 4
(3,760 Views)

hi alex,

 

sorry for the unconventionally way to get in contact regarding FTDI. but I thought I'll meet you here. I cant get running your FT2XX_demo-Example  inside CVI 2009. should it or are there problems ?

 

best regards

 

Simon

0 Kudos
Message 4 of 4
(3,370 Views)