slam666 Posted April 4, 2005 Posted April 4, 2005 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.
buzz44 Posted April 4, 2005 Posted April 4, 2005 (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 April 4, 2005 by burrup qq
slam666 Posted April 4, 2005 Author Posted April 4, 2005 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}>
buzz44 Posted April 4, 2005 Posted April 4, 2005 Whoops my bad, when I highlighted and copied it I must of missed that last bracket . qq
slam666 Posted April 5, 2005 Author Posted April 5, 2005 (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 April 5, 2005 by slam666
SlimShady Posted April 5, 2005 Posted April 5, 2005 (edited) Here's a working version. Edit: - Removed: reset label to nothing - Added: leading zero for 1 digit seconds and minutes. expandcollapse popup#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 April 5, 2005 by SlimShady
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now