LabWindows/CVI

Content Type
Programming Language
Current manual

RunUserInterface

RunUserInterface

int RunUserInterface (void);

Purpose

Runs the user interface and issues events to callback functions.

RunUserInterface does not return until you call QuitUserInterface from within a callback function. RunUserInterface returns the value that you pass to QuitUserInterface.

Note Note   To increase the speed with which the RunUserInterface function executes, consider calling the SetSleepPolicy function prior to calling the RunUserInterface function. Set the value of the sleepPolicy input of the SetSleepPolicy function to VAL_SLEEP_NONE.

Example Code

The following example code demonstrates how to use this function to run a user interface.

Note Note  QuitUserInterface causes RunUserInterface to return and terminates event processing but does not terminate the program itself.

static int panelHandle;

int main (int argc, char *argv[])

{

int status;

if (InitCVIRTE (0, argv, 0) == 0)

return -1; /* out of memory */

if ((panelHandle = LoadPanel (0, "sample.uir", PANEL)) < 0)

return -1;

DisplayPanel (panelHandle);

status = RunUserInterface ();

DiscardPanel (panelHandle);

return 0;

}

/* additional callback functions here */

int CVICALLBACK QuitCallback (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)

{

switch (event)

{

case EVENT_COMMIT:

QuitUserInterface (0); /* The value passed to QuitUserInterface
                       becomes the value returned
                       by RunUserInterface. */

break;

}

return 0;

}

Parameters

None.

Return Value

Name Type Description
returnCode int Value that you pass to QuitUserInterface.

Additional Information

Library: User Interface Library

Include file: userint.h

LabWindows/CVI compatibility: LabWindows/CVI 3.0 and later

Example

Refer to userint\events.cws for an example of using the RunUserInterface function.

Was this information helpful?