Loc,
Try this:
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
; Arrays to hold table ControlIDs and states
Global $aTables[5], $aState[5]
; Array of required colours
Global $aColours[3] = [0x0000FF, 0xFF0000, 0xFFFFFF]
$hGUI = GUICreate("Test", 500, 500)
GUISetBkColor(0xC4C4C4)
; Create the labels usign an algorithm
For $i = 0 To 4
$aTables[$i] = GUICtrlCreateLabel($i + 1, ($i * 100) + 5, 5, 90, 90, BitOr($SS_NOTIFY, $SS_CENTER, $SS_CENTERIMAGE))
GUICtrlSetFont($aTables[$i], 24, 800)
; Ste intial colour
GUICtrlSetColor($aTables[$i], 0xFF8000)
GUICtrlSetBkColor($aTables[$i], $aColours[0])
Next
GUISetState()
While 1
$iMsg = GUIGetMsg()
Switch $iMsg
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
; Look for a table being clicked
For $i = 0 To 4
If $iMsg = $aTables[$i] Then
; Increase table state - using Mod automatically resets to 0 when required
$aState[$i] = Mod($aState[$i] + 1, 3)
; Now set table tot he correct colour
GUICtrlSetBkColor($aTables[$i], $aColours[$aState[$i]])
; No point in looking further
ExitLoop
EndIf
Next
WEnd
How does that look?
M23