LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

display actual time like a digital clock

Hallo,

can somebody tell me how I can display time like a clock?

I get the actual time from my machine. I convert it into HH:MM:SS.
Now I want to print it every second new.
Is there already sample or something else?

thanks
Florian

Message Edited by Greber on 05-12-2005 09:30 AM

0 Kudos
Message 1 of 4
(3,633 Views)
I usually accomplish this task by using a slow conventional timer and a string control: in the timer callback I update the string value with
SetCtrlAttribute (mainH, Main_hh, ATTR_CTRL_VAL, TimeStr ());

TimerStr returns a string already formatted in HH:MM:SS.


Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 2 of 4
(3,622 Views)
To add to Roberto's suggestion. I use an asynchronous timer to do a lot of UI status updates in my programs. I just throw the code to update the clock into the timer callback and it works beautifully.

The reason I do this is because I use multithreading to keep the various tasks in my program from slowing the user interface down to the pace of a slug. Even if you are not explicitly using multithreading, the asynchronous timer is a good approach because it runs in its own thread and won't get bogged down by other things that are going on in your program. Throw a ProcessSystemEvents() call into the timer callback and make the timer interval say 500 mS and the user interface will always respond in a timely manner.
Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 3 of 4
(3,614 Views)
If you want to do anything fancier than write a string to a text box, you could look at ActiveX controls.
If you have Visual C++, you can build an ActiveX object from this sample project.
Click here for the Code Projects sample.
Visual C++ also ships with a sample ActiveX clock. Click here a tutorial for using it.
0 Kudos
Message 4 of 4
(3,610 Views)