Jump to content
Sign in to follow this  
slam666

Display refresh problem

Recommended Posts

slam666

Hi,

I have the following code

$_StartTimeGlobal = GUICtrlCreateLabel("Start time : 00:00:00", 10, 470)

...

GUICtrlSetData($_StartTimeGlobal,StringFormat ( "Start time : %2d:%2d:%2d", @HOUR, @MIN, @SEC))

The problem I am having is the display is not correct, when I try to update the $_StartTimeGlobal it display the string over the previous one instead of replacing it.

Any idea?

Thanks.

Share this post


Link to post
Share on other sites
buzz44

Before you enter the new time, reset the value back to nothing, like below

$_StartTimeGlobal = GUICtrlCreateLabel("Start time : 00:00:00", 10, 470)

...
GUICtrlSetData($_StartTimeGlobal, ""); Sets the value to nothing
GUICtrlSetData($_StartTimeGlobal,StringFormat ( "Start time : %2d:%2d:%2d", @HOUR, @MIN, @SEC)

BTW, the line

GUICtrlSetData($_StartTimeGlobal,StringFormat ( "Start time : %2d:%2d:%2d", @HOUR, @MIN, @SEC)
is missing a ")" (Bracket) at the end. Edited by burrup

qq

Share this post


Link to post
Share on other sites
slam666

Ok Thanks, will try that, btw there is 2 bracket at the end :)

Before you enter the new time, reset the value back to nothing, like below

$_StartTimeGlobal = GUICtrlCreateLabel("Start time : 00:00:00", 10, 470)

...
GUICtrlSetData($_StartTimeGlobal, ""); Sets the value to nothing
GUICtrlSetData($_StartTimeGlobal,StringFormat ( "Start time : %2d:%2d:%2d", @HOUR, @MIN, @SEC)

BTW, the line

GUICtrlSetData($_StartTimeGlobal,StringFormat ( "Start time : %2d:%2d:%2d", @HOUR, @MIN, @SEC)
is missing a ")" (Bracket) at the end.

<{POST_SNAPBACK}>

Share this post


Link to post
Share on other sites
buzz44

Whoops my bad, when I highlighted and copied it I must of missed that last bracket :).


qq

Share this post


Link to post
Share on other sites
slam666

Hi,

It still does not work and I dont know if its because my program is not active, it is set as StayOnTop but when I update the label the program does not have focus.

Is there a way to refresh the window?

Thanks.

Edited by slam666

Share this post


Link to post
Share on other sites
SlimShady

Here's a working version.

Edit:

- Removed: reset label to nothing

- Added: leading zero for 1 digit seconds and minutes.

#include <GUIConstants.au3>
AutoItSetOption("TrayIconDebug", 1)

;Initialize variables
Global $style1
Global $IniFile
Global $GUIWidth
Global $GUIHeight

$GUIWidth = 250
$GUIHeight = 250
$IniFile = StringTrimRight(@ScriptFullPath, 3) & "ini"

$OldSec = @SEC

GUICreate("New GUI", $GUIWidth, $GUIHeight)

$_StartTimeGlobal = GUICtrlCreateLabel("Start time : 00:00:00", 10, 40)

GUISetState(@SW_SHOW)

While 1
   Sleep(25)
   $msg = GUIGetMsg()
   Select
   
      Case $msg = $GUI_EVENT_CLOSE
         GUIDelete()
         Exit

      Case $OldSec <> @SEC
         GUICtrlSetData($_StartTimeGlobal,StringFormat ( "Start time : %2d:%02d:%02d", @HOUR, @MIN, @SEC))
         $OldSec = @SEC

   EndSelect

WEnd
Edited by SlimShady

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.