Sign in to follow this  
Followers 0
slam666

Display refresh problem

6 posts in this topic

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



#2 ·  Posted (edited)

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

[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

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

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


[u]Old Projects:[/u]A3MORGB2Hex[u]Old Functions:[/u]_TimeAdd/_TimeSub_AddComma_BubbleSort _RippleSort "He who does not understand your silence will probably not understand your words." - Elbert Hubbard.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

#6 ·  Posted (edited)

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  
Followers 0