hoppfrosch
Joined: 25 Jan 2006 Posts: 16 Location: Somewhere in Germany
|
Posted: Thu Dec 14, 2006 8:32 am Post subject: Basic Problem with global variables and controls |
|
|
I've got a problem with variables in controls in context with functions. I think it's a basic problem of my understanding how AHK works - but nevertheless I cannot figure out, how it works ...
I tried the following:
| Code: |
...
GuiTitlebarClock()
return
; -------------------------------------------------------------------------------------------------
; Toogle display of clock in titlebar
;
GuiTitlebarClock(Timerduration=1000)
{
FormatTime, TimeString, , hh:mm:ss - ddd, dd MMM
Gui, +ToolWindow +AlwaysOnTop -SysMenu
Gui, -Caption ;
;*********************************************************************************************************
;**** Error occurs on the following line *************************************************************
Gui, Add, Text, vTxtCurrentTime x+10 y5, %TimeString%
;*********************************************************************************************************
Gui, Show, AutoSize NoActivate xcenter y0 h18 w240, %TimeString%
WinSet, TransColor, CCCCCC 255, ahk_class AutoHotkeyGUI
SetTimer, AdjustTime, %Timerduration%
}
....
|
What happens? When I start the script, AHK says: Error: A control's variable must be global. The curtrent thread will exit. Specifically: vTxtCurrentTime. The error occurs in the marked line in the code excerpt ...
How can I avoid this? I made several attempts to "make the variable global" - but didn't succeed ...
Thanks
Hoppfrosch |
|