LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

unable to update Time in RunUserInterface

While running our program, we want to update Time in our Panel but with RunUserInterface and using panel callbacks we are unable to update Time.
We are working in Windows-2000
0 Kudos
Message 1 of 4
(3,077 Views)
Assuming you mean that you have a control on your panel showing time of day, the most common way of updating it is to put a timer control on the panel, and use the EVENT_TIMER_TICK event in the timer's callback to update your control.
--
Martin
Certified CVI Developer
0 Kudos
Message 2 of 4
(3,077 Views)
Hello Scientist,

perhaps have a look at the InstallMainCallback function.

Example:

in the main routine you have to install the callback like:
InstallMainCallback (MyLoop, 0, 1);

In the MyLoop function you can put code like this to display systemtime
continuously :

int MyLoop()
{
int h, m, s;
char time[20];

GetSystemTime (&h, &m, &s);
sprintf(time, "%.2d:%.2d:%.2d", h, m, s);
SetCtrlVal(main_panel, PANEL_TIME, time);
}

regards
Gregoire
0 Kudos
Message 3 of 4
(3,077 Views)
Hello,
I'm not sure what you mean by "unable to update Time"; do you mean that the UI does not display the updated time? If so, it might be because one of the callback functions takes a long time to execute, and while it is executing, your program cannot process other events (in this case a UI event), therefore it cannot update the UI until that long callback function exits.

What you can do is, call ProcessDrawEvents or ProcessSystemEvents functions in the callback function that is taking a long time to execute. Those two functions allow LabWindows/CVI to process other events before the callback function exits. Please refer to LabWindows/CVI Help that ships with LabWindows/CVI for more information on ProcessDrawEvents and ProcessSystemEvents.

Mika Fukuchi
Appl
ication Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,077 Views)