Time... to refresh

Hi to all,
sorry but i’m a very newbie to xojo… and programming
I’ve tried to create a simple Windows with a label showing second that are in the computer sistem.
I can do that but the problem is that i don’t understand how i can show second changing.
I show the ones are when i active the window.
Can someone show me the code.
Thanks

Take a look at Timers. Then you just place the code you use to determine the time when the window activates in the Action event of the timer instead and it will be run repeatedly (every second by default).

The documentation indicates its the same as VB actually.

Use the control name and .Refresh. For example:

Label1.Refresh

This repaints the control contents immediately.

[beaten to the punch with the Timer method]
As a newbie you should definitley check out the documentation over at http://documentation.xojo.com
On the front page you’ll see a list of books under a heading that says User Guide. Read them all :slight_smile:

Like Jason said, for seconds and time related stuff, using Timers is probably better,

[quote=83040:@Derek DiBenedetto]The documentation indicates its the same as VB actually.

Use the control name and .Refresh. For example:

Label1.Refresh

This repaints the control contents immediately.[/quote]
Although this will work, it is recommended that you use Invalidate instead. So it would be:

Label1.Invalidate

Although that will not change the string shown in the label caption.

Refresh should not be necessary at all.

Thanks to all. Is a little bit hard to understand the general way to write the code. I’m tring to study exemple and documentation.

In the window editor drag a Timer from the library (the control pallet of the right) to the window an drop it.
Double click on the Timer instance.
Add the (only) event called “Action”.
Enter the following code:

YourLabelName.Text = Str(Ticks / 60) + " sec."