Sign in to follow this  
Followers 0
ReDFlaG

timer and array

5 posts in this topic

Hi :)

Little issue with that simple code, may someone tell me why i can' t have the array displayed ?

#include <Timers.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>


$mainwindow = GUICreate("TEST", 400, 320)
GUISetState(@SW_SHOW)

global $arr_switch[5] = ["Item 0", "Item 1", "Item 2", "Item 3", "Item 4"]

Func _AutoRefresh($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    _ArrayDisplay($arr_switch)
EndFunc

$autorefresh=_Timer_SetTimer ($mainwindow,6000,"_AutoRefresh")

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
WEnd

Thanks :)

Share this post


Link to post
Share on other sites



Use consolewrite.  don't pause your script.

saludos

Share this post


Link to post
Share on other sites

or use adlibregister

#include <Timers.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>


$mainwindow = GUICreate("TEST", 400, 320)
GUISetState(@SW_SHOW)

global $arr_switch[5] = ["Item 0", "Item 1", "Item 2", "Item 3", "Item 4"]


Func _AutoRefresh()
    _ArrayDisplay($arr_switch)
EndFunc

AdlibRegister("_AutoRefresh",6000)

While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
        EndSwitch
WEnd
AdlibUnRegister("_AutoRefresh")

I keep thinking best way is use consolewrite.

saludos

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Or use put the _ArrayDisplay in the main loop :

#include <Timers.au3>
#include <Array.au3>
#include <GUIConstantsEx.au3>

$iDisplay = 0

$mainwindow = GUICreate("TEST", 400, 320)
GUISetState(@SW_SHOW)

global $arr_switch[5] = ["Item 0", "Item 1", "Item 2", "Item 3", "Item 4"]

Func _AutoRefresh($hWnd, $Msg, $iIDTimer, $dwTime)
    #forceref $hWnd, $Msg, $iIDTimer, $dwTime
    $iDisplay = 1
EndFunc

$autorefresh=_Timer_SetTimer ($mainwindow,6000,"_AutoRefresh")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            ExitLoop
    EndSwitch
    
    If $iDisplay Then
        $iDisplay = 0
        _ArrayDisplay($arr_switch)
    EndIf
WEnd
Edited by jguinch

Share this post


Link to post
Share on other sites

both solution are working. thanks :)

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