LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

RunUserInterface:one for each panel or one (in the "main" e.g.) for all panels

Philosofical question regarding the use of RunUserInterface: is it (more) correct to use one RunUserInterface for each panel to be displayed or a unique RunUserInterface (in the "main" for instance) for all the panels to be displayed in the rest of the program ?
0 Kudos
Message 1 of 4
(2,860 Views)
It's more than a philosophical question. You have only one user interface. It can have any number of panels, but together they make up the one user interface.
Since you have only one user interface, you should run it only once. It is typical to RunUserInterface in main(). If you start a project by creating the UIR file and then goto Code >> Generate >> All Code, you'll see the structure that CVI creates.
Another option is not to use RunUserInterface at all, but call GetUserEvent in a loop. See the GetUserEvent.prj sample project that ships with CVI.
0 Kudos
Message 2 of 4
(2,860 Views)
my first problem was to create a new panel that simulates the behavior of the MessagePopup and related; these functions works and displays a window even without a RunUserInterface in the main, so I think they have a own RunUserInterface embedded in them.
What's wrong in this hypothesis ?
0 Kudos
Message 3 of 4
(2,860 Views)
You don't need to RunUserInterface() to display a panel. The GetUserEvent.prj sample project the ships with CVI does not call RunUserInterface(), directly or indirectly.
If you want to create a dialog box function that runs regardless of whether or not RunUserInterface() has been called, do the following in your function:
LoadPanel() or LoadPanelEx()
DisplayPanel()
GetUserEvent() in a loop waiting for the event(s) on which to end the dialog.
DiscardPanel().
0 Kudos
Message 4 of 4
(2,860 Views)