Jump to content

timer and array


ReDFlaG
 Share

Recommended Posts

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 :)

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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
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...