Jump to content

help! with dynamic variables


gcue
 Share

Recommended Posts

good idea.

ok i still have the same problem:

i startup a stopwatch and the count starts as normal

but when i start up another stopwatch the count on the first stopwatch stops updating and the new stowatch count updates only on the new window

so i think the updatetime() function is only running on the previous stopwatch window..

Here's that function:
Func Update_Time()
    _TicksToTime(Int(TimerDiff($timer)), $hour, $mins, $secs)
    Local $sTime = $_time; save current time to be able to test and avoid flicker..
    $_time = StringFormat("%02i:%02i:%02i", $hour, $mins, $secs)
    If $sTime <> $_time Then ControlSetText(@GUI_WinHandle, "", $time, $_time)
EndFunc  ;==>Update_Time

Now what event calls that function? Because @GUI_WinHandle is only valid while handling an event. If this is not called by an event, @GUI_WinHandle may just have the handle of the GUI that produced the last event before you called Update_Time(). Perhaps you should update with a For/Next loop to get all the handles you have in $avStopWatches.

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

ahh now this is making a bit more sense to me..

it shouldnt matter if the child window has a "0x.." formatted $string attached to it right?

bc now it doesnt update at all.. (even though the arraydisplay shows the existence of a stopwatch window)

Func Update_Time()
    ;_ArrayDisplay($avStopWatches)
    For $i = 1 To $avStopWatches[0]
        _TicksToTime(Int(TimerDiff($timer)), $hour, $mins, $secs)
        Local $sTime = $_time ; save current time to be able to test and avoid flicker..
        $_time = StringFormat("%02i:%02i:%02i", $hour, $mins, $secs)
        If $sTime <> $_time Then ControlSetText($avStopWatches[$i], "", $time, $_time)
    Next
    
EndFunc   ;==>Update_Time
Link to comment
Share on other sites

ahh now this is making a bit more sense to me..

it shouldnt matter if the child window has a "0x.." formatted $string attached to it right?

bc now it doesnt update at all.. (even though the arraydisplay shows the existence of a stopwatch window)

Func Update_Time()
;_ArrayDisplay($avStopWatches)
    For $i = 1 To $avStopWatches[0]
        _TicksToTime(Int(TimerDiff($timer)), $hour, $mins, $secs)
        Local $sTime = $_time; save current time to be able to test and avoid flicker..
        $_time = StringFormat("%02i:%02i:%02i", $hour, $mins, $secs)
        If $sTime <> $_time Then ControlSetText($avStopWatches[$i], "", $time, $_time)
    Next
EndFunc  ;==>Update_Time
So what is $time in your ControlSetText()? How can that be the correct ControlID for each GUI?

:)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

its the text label where the time updates

ahh ok - definitely makes sense..

so i added this when the button gets created

$start_btn = GUICtrlCreateButton("START", 10, 30, 50, 20)
    GUICtrlSetOnEvent($start_btn, "Start_Time")
    _ArrayAdd($start_btns, $start_btn)
    _ArrayAdd($times, $time)oÝ÷ ÚÊ%j׫§·z·§qè­wvÚ¡§è®Z(¦¸ ØfØb²+ zÛb   ²ÌºØ^iا)íêâ]·¶*'®(!µ«­¢+ÙÕ¹UÁÑ}Q¥µ ¤(í}ÉÉå¥ÍÁ±ä ÀÌØíÙMѽÁ]ѡ̤(}Q¥­ÍQ½Q¥µ¡%¹Ð¡Q¥µÉ¥ ÀÌØíÑ¥µÈ¤¤°ÀÌØí¡½ÕÈ°ÀÌØíµ¥¹Ì°ÀÌØíÍ̤(1½°ÀÌØíÍQ¥µôÀÌØí}Ñ¥µìÍÙÕÉɹÐÑ¥µÑ¼±Ñ¼ÑÍйٽ¥±¥­È¸¸(ÀÌØí}Ñ¥µôMÑÉ¥¹½ÉµÐ ÅÕ½ÐìÀɤèÀɤèÀɤÅÕ½Ðì°ÀÌØí¡½ÕÈ°ÀÌØíµ¥¹Ì°ÀÌØíÍ̤(½ÈÀÌØí¤ôÄQ¼ÀÌØíÙMѽÁ]Ñ¡ÍlÁt(½ÈÀÌØíÐôÄQ¼ÀÌØíÑ¥µÍlÁt(%ÀÌØíÍQ¥µ±ÐìÐìÀÌØí}Ñ¥µQ¡¸
½¹Ñɽ±MÑQáÐ ÀÌØíÙMѽÁ]Ñ¡ÍlÀÌØí¥t°ÅÕ½ÐìÅÕ½Ðì°ÀÌØíÑ¥µÍlÀÌØíÑt°ÀÌØí}Ñ¥µ¤(9áÐ(9áÐ)¹Õ¹ìôôÐíUÁÑ}Q¥µ

thank you so much for guiding me through this mess!

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...