VenusProject2

GUI contaminated by closing child GUI

4 posts in this topic

#1 ·  Posted (edited)

Trying to isolate the cause of my parent GUI's graphic becoming contaminated by closing of a child GUI.

The example script below creates the parent GUI, then I click a button to display a digital clock, I use keys to start, pause & resume the clock. NOTE: to exit the clock display after the clock has started hold down the 'ESC' key for more than 3seconds. Upon the clock closing the contamination should be evident.

2016-03-08-GUI_Rubbish.jpg

 

#include <Misc.au3>
#include <GUIConstants.au3>
#include <Date.au3>

HotKeySet("{ESC}", "_ExitClock");To Exit Digital Clock use "Esc" key held for >3sec

Dim $aXY[2]
Global $Init0, $PausedTimer, $iTimerHours, $iTimerMins, $iTimerSecs
Global $sec = @SEC
Global $hDLL = DllOpen("user32.dll")
Global $iEvent = 0
Global $AlarmHour = 0
Global $AlarmMin = 0
Global $AlarmSec = 0
Global  $SecSquare = GUICtrlCreateGraphic(0, 0, 0, 0)
Global  $ClockSquare = GUICtrlCreateGraphic(5, 5, 180, 30);Local Time
Global  $TimerSquare = GUICtrlCreateGraphic(205, 5, 220, 30);Timer
Global $AlarmSquare = GUICtrlCreateGraphic(480, 5, 220, 30);Alarm Time
Global $gui
Dim $aDigChar[14]
_initDigChar($aDigChar)

; Create a GUI with various controls.
Local $Form1 = GUICreate("Example")

Local $StartB = GUICtrlCreateButton("Use 'Alt+S' to start Clock", 130, 200, 150, 25)
Local $PauseB = GUICtrlCreateButton("Use 'Alt+P' to pause Clock", 130, 250, 150, 25)
Local $ResumeB = GUICtrlCreateButton("Use 'Alt+R' to resume Clock", 130, 300, 150, 25)
GUICtrlSetState($StartB, $GUI_DISABLE)
GUICtrlSetState($PauseB, $GUI_DISABLE)
GUICtrlSetState($ResumeB, $GUI_DISABLE)

Local $OK = GUICtrlCreateButton("Display Clock", 270, 370, 125, 25)

; Display the GUI.
GUISetState(@SW_SHOW, $Form1)

; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idOK
            ExitLoop
        Case $OK
            _DigitalClock()

    EndSwitch
WEnd

; Delete the previous GUI and all controls.
GUIDelete($Form1)


Func _DigitalClock()
    $gui = GUICreate("Digital Timer", 702, 40, -1, -1, -1, $WS_EX_TOPMOST)
    ;$gui = GUICreate("Test", 702, 702)
    GUISetBkColor(0x000000)

    GUISetState()


    $SecSquare = GUICtrlCreateGraphic(0, 0, 0, 0)
    $ClockSquare = GUICtrlCreateGraphic(5, 5, 180, 30);Local Time
    $TimerSquare = GUICtrlCreateGraphic(205, 5, 220, 30);Timer
    $AlarmSquare = GUICtrlCreateGraphic(480, 5, 220, 30);Alarm Time




    Dim $msg[1]
    ;$AddMinutes = 10
    While 1
        ; main loop, waits until @sec changes and then executes main drawing management function
        While @SEC = $sec
            $msg = GUIGetMsg(1)
            If $msg[0] = -3 Then
                DllClose($hDLL)
                Return
            EndIf
            If _IsPressed("12", $hDLL) Then;'Alt'
                ConsoleWrite("_IsPressed - Alt Key was pressed." & @CRLF)

                ; Wait until key is released.
                    While _IsPressed("12", $hDLL);
                        If _IsPressed("53",$hDLL) Then;'s'
                            ConsoleWrite("_IsPressed - 'o' Key was pressed." & @CRLF)

                            start_timer()
                        EndIf
                        If _IsPressed("50",$hDLL) Then;'p'
                            ConsoleWrite("_IsPressed - 'p' Key was pressed." & @CRLF)
                            pause_timer()
                        EndIf
                        If _IsPressed("52",$hDLL) Then;'r'
                            ConsoleWrite("_IsPressed - 'r' Key was pressed." & @CRLF)
                            resume_timer()
                        EndIf
                        Sleep(300);(250)
                    WEnd
            ElseIf _IsPressed("1B", $hDLL) Then
                MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
                ExitLoop
            EndIf

            Sleep(10)

        WEnd

        _draw()
        Sleep(50)
        $sec = @SEC
    WEnd
EndFunc; ==> _DigitalCLock


Func _ExitClock();Press Escape key for >5sec
    Local $Count = 0
    If _IsPressed("1B",$hDLL) Then
        $Return = _KeyPressed("1B", $Count)
        ConsoleWrite("Escape Key Held for - " & $Return & "mS" & @CRLF)
        If $Return > 3000 Then
            DllClose($hDLL)
            AdlibUnRegister("show_timer")
            GUIDelete($gui)
            GUISetState(@SW_ENABLE, $Form1);enable parent GUI
            GUISetState(@SW_SHOW,$Form1)
        EndIf
    Endif
EndFunc;==>_ExitClock()

Func _KeyPressed($kp_Key, ByRef $kp_Count)
    $kp_Count += 1
    Local $kp_Timer = TimerInit()
    While _IsPressed("1B")
        Sleep(100)
    WEnd
    Return TimerDiff($kp_Timer)
EndFunc   ;==>_KeyPressed


;################ Functions from StopwatchUDF.au3 #####################
; The function that starts or resets the stopwatch
Func start_timer()
   HotKeySet("{NUMPADMULT}") ;disable resume timer
   HotKeySet("{NUMPADSUB}", "pause_timer") ;enable pause timer
   $PausedTimer = 0
   $Init0 = TimerInit()
   AdlibRegister("show_timer", 60)


EndFunc   ;==>start_timer

; The function that pauses the stopwatch
Func pause_timer()
   HotKeySet("{NUMPADSUB}") ;disable pause timer
   HotKeySet("{NUMPADMULT}", "resume_timer") ;enable resume timer
   $PausedTimer += Int(TimerDiff($Init0))
   AdlibUnRegister()
EndFunc   ;==>pause_timer

; The function that resumes the stopwatch
Func resume_timer()
   HotKeySet("{NUMPADMULT}") ;disable resume timer
   HotKeySet("{NUMPADSUB}", "pause_timer") ;enable pause timer
   $Init0 = TimerInit()
   AdlibRegister("show_timer", 60)
EndFunc   ;==>resume_timer

Func show_timer()     ; _TicksToTime to get hours, mins, seconds
   _TicksToTime(Int(TimerDiff($Init0) + $PausedTimer), $iTimerHours, $iTimerMins, $iTimerSecs)

   ;StringFormat to display the time as HH:MM:SS
   ;ToolTip("HH:MM:SS = " & StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs), 0, 0, "Timer")
EndFunc   ;==>show_timer

; Exit
Func Quit()
   Exit
EndFunc   ;==>Quit
;################ Functions from StopwatchUDF.au3 #####################

Func _draw($forceDraw = False)
    ; calculates angles for min/sec dials, manages execution of drawing routines
    Local $doDraw = False

    Sleep(25)
    ;_drawSec()
    _DrawClock()
    _DrawTimer();Digital Cue Timer 00:00:00
    _DrawAlarmTime($iEvent);Event no. in Sequence with Hints in test string
    GUICtrlSetGraphic($SecSquare, $GUI_GR_REFRESH)
EndFunc   ;==>_draw
;#cs
Func _DrawClock();Digital System Time
    ;return
    ; manages execution of write commands for HH MM SS characters
    GUICtrlDelete($ClockSquare)
    $ClockSquare = GUICtrlCreateGraphic(5, 5, 180, 30);5, 5, 200, 30
    _timeWrite(0, Int(@HOUR / 10), "regular", $ClockSquare);e.g. 1pm = 13 /10 =1
    _timeWrite(20, Mod(@HOUR, 10), "regular", $ClockSquare);e.g. 1pm = 13Mod10 = 1 with 3 remainder
    _timeWrite(50, Int(@MIN / 10), "regular", $ClockSquare)
    _timeWrite(70, Mod(@MIN, 10), "regular", $ClockSquare)
    _timeWrite(100, Int(@SEC / 10), "regular", $ClockSquare)
    _timeWrite(120, Mod(@SEC, 10), "regular", $ClockSquare)
EndFunc   ;==>_drawTime
;#ce
Func _DrawTimer();Digital Cue Timer 00:00:00
    ;return
    ; manages execution of write commands for HH MM SS characters
    GUICtrlDelete($TimerSquare)
    $TimerSquare = GUICtrlCreateGraphic(205, 5, 220, 30);Timer
    _timeWrite(0, 13, "Timer", $TimerSquare);C
    _timeWrite(20, 11, "Timer", $TimerSquare);L
    _timeWrite(50, 12, "Timer", $TimerSquare);-
    _timeWrite(80, Int($iTimerHours / 10), "Timer", $TimerSquare)
    _timeWrite(100, Mod($iTimerHours, 10), "Timer", $TimerSquare)
    _timeWrite(130, Int($iTimerMins / 10), "Timer", $TimerSquare)
    _timeWrite(150, Mod($iTimerMins, 10), "Timer", $TimerSquare)
    _timeWrite(180, Int($iTimerSecs / 10), "Timer", $TimerSquare)
    _timeWrite(200, Mod($iTimerSecs, 10), "Timer", $TimerSquare)

EndFunc   ;==>_drawTime
;#cs
Func _drawAlarmTime($iEvent);Digital Time
    ;Return
    ; manages execution of write commands for HH MM SS characters for the Alarm time
    GUICtrlDelete($AlarmSquare)
    $AlarmSquare = GUICtrlCreateGraphic(480, 5, 220, 30)
    _timeWrite(0, 10, "Alarm", $AlarmSquare);A
    _timeWrite(20, 11, "Alarm", $AlarmSquare);L
    _timeWrite(50, 12, "Alarm", $AlarmSquare);-
    _timeWrite(80, Int($AlarmHour / 10), "Alarm", $AlarmSquare)
    _timeWrite(100, Mod($AlarmHour, 10), "Alarm", $AlarmSquare)
    _timeWrite(130, Int($AlarmMin / 10), "Alarm", $AlarmSquare)
    _timeWrite(150, Mod($AlarmMin, 10), "Alarm", $AlarmSquare)
    _timeWrite(180, Int($AlarmSec / 10), "Alarm", $AlarmSquare)
    _timeWrite(200, Mod($AlarmSec, 10), "Alarm", $AlarmSquare)
EndFunc   ;==>_drawAlarmTime
;#ce
Func _timeWrite($pos, $num, $type, $graph) ; $type is "Regular" or "Alarm" or "Timer"
    ; manages coloring and writing of 7 segement LEDs for time writing

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 1, 1), $type);0
    _line($graph, $pos + 5, 2, $pos + 3, 10)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 2, 1), $type);1
    _line($graph, $pos + 2, 14, $pos + 0, 22)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 3, 1), $type);2
    _line($graph, $pos + 5 + 2, 0, $pos + 5 + 8, 0)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 4, 1), $type);3
    _line($graph, $pos + 2 + 2, 12, $pos + 2 + 8, 12)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 5, 1), $type);4
    _line($graph, $pos + 2, 24, $pos + 8, 24)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 6, 1), $type);5
    _line($graph, $pos + 5 + 10, 2, $pos + 3 + 10, 10)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 7, 1), $type);6
    _line($graph, $pos + 2 + 10, 14, $pos + 10, 22)
EndFunc   ;==>_timeWrite

;#cs
Func _line($graph, $x1, $y1, $x2, $y2);Seven Segment Display
    ;Return
    ; draws line for time writing
    GUICtrlSetGraphic($graph, $GUI_GR_MOVE, $x1 + 2, $y1 + 2)
    GUICtrlSetGraphic($graph, $GUI_GR_LINE, $x2 + 2, $y2 + 2)
EndFunc   ;==>_line
;#ce
Func _setColorAndPenForWrite($char, $type)
    ; sets color and pen for next line in time writing, based on '0' or '1' in the DigChar array
    If $char = "1"  Then;7 Segment display ON=1 or OFF=0
        If $type = "Alarm"  Then
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_COLOR, 0xCCCCCC, 0xCCCCCC)
        ElseIf $type = "Timer" Then
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_COLOR, 0x00ff00, 0x00ff00);ct - Bright Green RGB
        Else
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_COLOR, 0xEE0000, 0xEE0000)
        EndIf
    Else
        If $type = "Alarm"  Then
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_COLOR, 0x222222, 0x222222)
        ElseIf $type = "Timer" Then;ct
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_COLOR, 0x002200, 0x002200);ct - Lite Green RGB
        Else
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_COLOR, 0x330000, 0x330000)
        EndIf
    EndIf
EndFunc   ;==>_setColorAndPenForWrite

Func _drawSec()
    Return
    ; draws circle seconds indicator
    $aXY = _getXY(@SEC, 240)
    GUICtrlDelete($SecSquare)
    $SecSquare = GUICtrlCreateGraphic(350 + $aXY[0] - 8, 350 + $aXY[1] - 8, 16, 16)
    GUICtrlSetGraphic($SecSquare, $GUI_GR_COLOR, 0x0000FF, 0x0000FF)
    GUICtrlSetGraphic($SecSquare, $GUI_GR_ELLIPSE, 0, 0, 16, 16)
EndFunc   ;==>_drawSec

Func _getXY($sec, $hypo)
    ; returns array with X,Y coordinates for the seconds points for $sec seconds, with $hypo(tenuse) distance from center
    Dim $result[2]
    Local $pi = 3.14159265358979
    Local $degToRad = $pi / 180
    Local $degrees = $sec * 6 - 90
    Local $x = Cos($degrees * $degToRad) * $hypo
    Local $y = Sin($degrees * $degToRad) * $hypo
    $result[0] = $x
    $result[1] = $y
    Return $result
EndFunc   ;==>_getXY


Func _initDigChar(ByRef $aDigChar)
    ; define leds for digital numbers: 1 or 0 for leds on/off in 7-led digital clock characters
    $aDigChar[0] = "1110111"
    $aDigChar[1] = "0000011"
    $aDigChar[2] = "0111110"
    $aDigChar[3] = "0011111"
    $aDigChar[4] = "1001011"
    $aDigChar[5] = "1011101"
    $aDigChar[6] = "1111101"
    $aDigChar[7] = "0010011"
    $aDigChar[8] = "1111111"
    $aDigChar[9] = "1011111"
    $aDigChar[10] = "1111011" ; A
    $aDigChar[11] = "1100100" ; L
    $aDigChar[12] = "0001000" ; -
    $aDigChar[13] = "1110100" ;C
EndFunc   ;==>_initDigChar

Any help appreciated

Thanks Chris

Edited by VenusProject2

Share this post


Link to post
Share on other sites



VenusProject2,

You were exiting the clock within the _ExitClock function which was called by a HotKey. This function deleted the clock GUI, but did not affect the loop inside the _DigitalClock function, so the _draw function was still called and, as the only GUI left was the main one, that is where the function drew the clock.

I suggest you use a flag to show when the clock has been killed in the HotKey function and look for that flag in the loop - like this:

#include <Misc.au3>
#include <GUIConstants.au3>
#include <Date.au3>

Opt("TrayIconDebug", 1)

Global $fClose = False

HotKeySet("{ESC}", "_ExitClock");To Exit Digital Clock use "Esc" key held for >3sec

Dim $aXY[2]
Global $Init0, $PausedTimer, $iTimerHours, $iTimerMins, $iTimerSecs
Global $sec = @SEC
Global $hDLL = DllOpen("user32.dll")
Global $iEvent = 0
Global $AlarmHour = 0
Global $AlarmMin = 0
Global $AlarmSec = 0
Global  $SecSquare = GUICtrlCreateGraphic(0, 0, 0, 0)
Global  $ClockSquare = GUICtrlCreateGraphic(5, 5, 180, 30);Local Time
Global  $TimerSquare = GUICtrlCreateGraphic(205, 5, 220, 30);Timer
Global $AlarmSquare = GUICtrlCreateGraphic(480, 5, 220, 30);Alarm Time
Global $gui
Dim $aDigChar[14]
_initDigChar($aDigChar)

; Create a GUI with various controls.
Local $Form1 = GUICreate("Example")

Local $StartB = GUICtrlCreateButton("Use 'Alt+S' to start Clock", 130, 200, 150, 25)
Local $PauseB = GUICtrlCreateButton("Use 'Alt+P' to pause Clock", 130, 250, 150, 25)
Local $ResumeB = GUICtrlCreateButton("Use 'Alt+R' to resume Clock", 130, 300, 150, 25)
GUICtrlSetState($StartB, $GUI_DISABLE)
GUICtrlSetState($PauseB, $GUI_DISABLE)
GUICtrlSetState($ResumeB, $GUI_DISABLE)

Local $OK = GUICtrlCreateButton("Display Clock", 270, 370, 125, 25)

; Display the GUI.
GUISetState(@SW_SHOW, $Form1)

; Loop until the user exits.
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $idOK
            ExitLoop
        Case $OK
            _DigitalClock()

    EndSwitch
WEnd

; Delete the previous GUI and all controls.
GUIDelete($Form1)


Func _DigitalClock()
    $gui = GUICreate("Digital Timer", 702, 40, -1, -1, -1, $WS_EX_TOPMOST)
    ;$gui = GUICreate("Test", 702, 702)
    GUISetBkColor(0x000000)

    GUISetState()


    $SecSquare = GUICtrlCreateGraphic(0, 0, 0, 0)
    $ClockSquare = GUICtrlCreateGraphic(5, 5, 180, 30);Local Time
    $TimerSquare = GUICtrlCreateGraphic(205, 5, 220, 30);Timer
    $AlarmSquare = GUICtrlCreateGraphic(480, 5, 220, 30);Alarm Time




    Dim $msg[1]
    ;$AddMinutes = 10
    While 1
        ; main loop, waits until @sec changes and then executes main drawing management function
        While @SEC = $sec
            $msg = GUIGetMsg(1)
            If $msg[0] = -3 Then
                DllClose($hDLL)
                Return
            EndIf
            If _IsPressed("12", $hDLL) Then;'Alt'
                ConsoleWrite("_IsPressed - Alt Key was pressed." & @CRLF)

                ; Wait until key is released.
                    While _IsPressed("12", $hDLL);
                        If _IsPressed("53",$hDLL) Then;'s'
                            ConsoleWrite("_IsPressed - 'o' Key was pressed." & @CRLF)

                            start_timer()
                        EndIf
                        If _IsPressed("50",$hDLL) Then;'p'
                            ConsoleWrite("_IsPressed - 'p' Key was pressed." & @CRLF)
                            pause_timer()
                        EndIf
                        If _IsPressed("52",$hDLL) Then;'r'
                            ConsoleWrite("_IsPressed - 'r' Key was pressed." & @CRLF)
                            resume_timer()
                        EndIf
                        Sleep(300);(250)
                    WEnd
            ElseIf _IsPressed("1B", $hDLL) Then
                MsgBox($MB_SYSTEMMODAL, "_IsPressed", "The Esc Key was pressed, therefore we will close the application.")
                ExitLoop
            EndIf

            Sleep(10)

        WEnd

        If $fClose Then
            $fClose = False
            AdlibUnRegister("show_timer")
            GUIDelete($gui)
            GUISetState(@SW_ENABLE, $Form1);enable parent GUI
            GUISetState(@SW_SHOW,$Form1)
            Return
        Else
            _draw()
            Sleep(50)
            $sec = @SEC
        EndIf
    WEnd
EndFunc; ==> _DigitalCLock


Func _ExitClock();Press Escape key for >5sec
    Local $Count = 0
    If _IsPressed("1B",$hDLL) Then
        $Return = _KeyPressed("1B", $Count)
        ConsoleWrite("Escape Key Held for - " & $Return & "mS" & @CRLF)
        If $Return > 3000 Then
            $fClose = True
        EndIf
    Endif
EndFunc;==>_ExitClock()

Func _KeyPressed($kp_Key, ByRef $kp_Count)
    $kp_Count += 1
    Local $kp_Timer = TimerInit()
    While _IsPressed("1B")
        Sleep(100)
    WEnd
    Return TimerDiff($kp_Timer)
EndFunc   ;==>_KeyPressed


;################ Functions from StopwatchUDF.au3 #####################
; The function that starts or resets the stopwatch
Func start_timer()
   HotKeySet("{NUMPADMULT}") ;disable resume timer
   HotKeySet("{NUMPADSUB}", "pause_timer") ;enable pause timer
   $PausedTimer = 0
   $Init0 = TimerInit()
   AdlibRegister("show_timer", 60)


EndFunc   ;==>start_timer

; The function that pauses the stopwatch
Func pause_timer()
   HotKeySet("{NUMPADSUB}") ;disable pause timer
   HotKeySet("{NUMPADMULT}", "resume_timer") ;enable resume timer
   $PausedTimer += Int(TimerDiff($Init0))
   AdlibUnRegister()
EndFunc   ;==>pause_timer

; The function that resumes the stopwatch
Func resume_timer()
   HotKeySet("{NUMPADMULT}") ;disable resume timer
   HotKeySet("{NUMPADSUB}", "pause_timer") ;enable pause timer
   $Init0 = TimerInit()
   AdlibRegister("show_timer", 60)
EndFunc   ;==>resume_timer

Func show_timer()     ; _TicksToTime to get hours, mins, seconds
   _TicksToTime(Int(TimerDiff($Init0) + $PausedTimer), $iTimerHours, $iTimerMins, $iTimerSecs)

   ;StringFormat to display the time as HH:MM:SS
   ;ToolTip("HH:MM:SS = " & StringFormat("%02i:%02i:%02i", $iHours, $iMins, $iSecs), 0, 0, "Timer")
EndFunc   ;==>show_timer

; Exit
Func Quit()
   Exit
EndFunc   ;==>Quit
;################ Functions from StopwatchUDF.au3 #####################

Func _draw($forceDraw = False)
    ; calculates angles for min/sec dials, manages execution of drawing routines
    Local $doDraw = False

    Sleep(25)
    ;_drawSec()
    _DrawClock()
    _DrawTimer();Digital Cue Timer 00:00:00
    _DrawAlarmTime($iEvent);Event no. in Sequence with Hints in test string
    GUICtrlSetGraphic($SecSquare, $GUI_GR_REFRESH)
EndFunc   ;==>_draw
;#cs
Func _DrawClock();Digital System Time
    ;return
    ; manages execution of write commands for HH MM SS characters
    GUICtrlDelete($ClockSquare)
    $ClockSquare = GUICtrlCreateGraphic(5, 5, 180, 30);5, 5, 200, 30
    _timeWrite(0, Int(@HOUR / 10), "regular", $ClockSquare);e.g. 1pm = 13 /10 =1
    _timeWrite(20, Mod(@HOUR, 10), "regular", $ClockSquare);e.g. 1pm = 13Mod10 = 1 with 3 remainder
    _timeWrite(50, Int(@MIN / 10), "regular", $ClockSquare)
    _timeWrite(70, Mod(@MIN, 10), "regular", $ClockSquare)
    _timeWrite(100, Int(@SEC / 10), "regular", $ClockSquare)
    _timeWrite(120, Mod(@SEC, 10), "regular", $ClockSquare)
EndFunc   ;==>_drawTime
;#ce
Func _DrawTimer();Digital Cue Timer 00:00:00
    ;return
    ; manages execution of write commands for HH MM SS characters
    GUICtrlDelete($TimerSquare)
    $TimerSquare = GUICtrlCreateGraphic(205, 5, 220, 30);Timer
    _timeWrite(0, 13, "Timer", $TimerSquare);C
    _timeWrite(20, 11, "Timer", $TimerSquare);L
    _timeWrite(50, 12, "Timer", $TimerSquare);-
    _timeWrite(80, Int($iTimerHours / 10), "Timer", $TimerSquare)
    _timeWrite(100, Mod($iTimerHours, 10), "Timer", $TimerSquare)
    _timeWrite(130, Int($iTimerMins / 10), "Timer", $TimerSquare)
    _timeWrite(150, Mod($iTimerMins, 10), "Timer", $TimerSquare)
    _timeWrite(180, Int($iTimerSecs / 10), "Timer", $TimerSquare)
    _timeWrite(200, Mod($iTimerSecs, 10), "Timer", $TimerSquare)

EndFunc   ;==>_drawTime
;#cs
Func _drawAlarmTime($iEvent);Digital Time
    ;Return
    ; manages execution of write commands for HH MM SS characters for the Alarm time
    GUICtrlDelete($AlarmSquare)
    $AlarmSquare = GUICtrlCreateGraphic(480, 5, 220, 30)
    _timeWrite(0, 10, "Alarm", $AlarmSquare);A
    _timeWrite(20, 11, "Alarm", $AlarmSquare);L
    _timeWrite(50, 12, "Alarm", $AlarmSquare);-
    _timeWrite(80, Int($AlarmHour / 10), "Alarm", $AlarmSquare)
    _timeWrite(100, Mod($AlarmHour, 10), "Alarm", $AlarmSquare)
    _timeWrite(130, Int($AlarmMin / 10), "Alarm", $AlarmSquare)
    _timeWrite(150, Mod($AlarmMin, 10), "Alarm", $AlarmSquare)
    _timeWrite(180, Int($AlarmSec / 10), "Alarm", $AlarmSquare)
    _timeWrite(200, Mod($AlarmSec, 10), "Alarm", $AlarmSquare)
EndFunc   ;==>_drawAlarmTime
;#ce
Func _timeWrite($pos, $num, $type, $graph) ; $type is "Regular" or "Alarm" or "Timer"
    ; manages coloring and writing of 7 segement LEDs for time writing

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 1, 1), $type);0
    _line($graph, $pos + 5, 2, $pos + 3, 10)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 2, 1), $type);1
    _line($graph, $pos + 2, 14, $pos + 0, 22)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 3, 1), $type);2
    _line($graph, $pos + 5 + 2, 0, $pos + 5 + 8, 0)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 4, 1), $type);3
    _line($graph, $pos + 2 + 2, 12, $pos + 2 + 8, 12)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 5, 1), $type);4
    _line($graph, $pos + 2, 24, $pos + 8, 24)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 6, 1), $type);5
    _line($graph, $pos + 5 + 10, 2, $pos + 3 + 10, 10)

    _setColorAndPenForWrite(StringMid($aDigChar[$num], 7, 1), $type);6
    _line($graph, $pos + 2 + 10, 14, $pos + 10, 22)
EndFunc   ;==>_timeWrite

;#cs
Func _line($graph, $x1, $y1, $x2, $y2);Seven Segment Display
    ;Return
    ; draws line for time writing
    GUICtrlSetGraphic($graph, $GUI_GR_MOVE, $x1 + 2, $y1 + 2)
    GUICtrlSetGraphic($graph, $GUI_GR_LINE, $x2 + 2, $y2 + 2)
EndFunc   ;==>_line
;#ce
Func _setColorAndPenForWrite($char, $type)
    ; sets color and pen for next line in time writing, based on '0' or '1' in the DigChar array
    If $char = "1"  Then;7 Segment display ON=1 or OFF=0
        If $type = "Alarm"  Then
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_COLOR, 0xCCCCCC, 0xCCCCCC)
        ElseIf $type = "Timer" Then
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_COLOR, 0x00ff00, 0x00ff00);ct - Bright Green RGB
        Else
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_COLOR, 0xEE0000, 0xEE0000)
        EndIf
    Else
        If $type = "Alarm"  Then
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($AlarmSquare, $GUI_GR_COLOR, 0x222222, 0x222222)
        ElseIf $type = "Timer" Then;ct
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($TimerSquare, $GUI_GR_COLOR, 0x002200, 0x002200);ct - Lite Green RGB
        Else
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_PENSIZE, 2)
            GUICtrlSetGraphic($ClockSquare, $GUI_GR_COLOR, 0x330000, 0x330000)
        EndIf
    EndIf
EndFunc   ;==>_setColorAndPenForWrite

Func _drawSec()
    Return
    ; draws circle seconds indicator
    $aXY = _getXY(@SEC, 240)
    GUICtrlDelete($SecSquare)
    $SecSquare = GUICtrlCreateGraphic(350 + $aXY[0] - 8, 350 + $aXY[1] - 8, 16, 16)
    GUICtrlSetGraphic($SecSquare, $GUI_GR_COLOR, 0x0000FF, 0x0000FF)
    GUICtrlSetGraphic($SecSquare, $GUI_GR_ELLIPSE, 0, 0, 16, 16)
EndFunc   ;==>_drawSec

Func _getXY($sec, $hypo)
    ; returns array with X,Y coordinates for the seconds points for $sec seconds, with $hypo(tenuse) distance from center
    Dim $result[2]
    Local $pi = 3.14159265358979
    Local $degToRad = $pi / 180
    Local $degrees = $sec * 6 - 90
    Local $x = Cos($degrees * $degToRad) * $hypo
    Local $y = Sin($degrees * $degToRad) * $hypo
    $result[0] = $x
    $result[1] = $y
    Return $result
EndFunc   ;==>_getXY


Func _initDigChar(ByRef $aDigChar)
    ; define leds for digital numbers: 1 or 0 for leds on/off in 7-led digital clock characters
    $aDigChar[0] = "1110111"
    $aDigChar[1] = "0000011"
    $aDigChar[2] = "0111110"
    $aDigChar[3] = "0011111"
    $aDigChar[4] = "1001011"
    $aDigChar[5] = "1011101"
    $aDigChar[6] = "1111101"
    $aDigChar[7] = "0010011"
    $aDigChar[8] = "1111111"
    $aDigChar[9] = "1011111"
    $aDigChar[10] = "1111011" ; A
    $aDigChar[11] = "1100100" ; L
    $aDigChar[12] = "0001000" ; -
    $aDigChar[13] = "1110100" ;C
EndFunc   ;==>_initDigChar

M23

1 person likes this

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Melba it has been said by many before me, but I'm compelled to say it again, you're the Jedi of code possibly part Vulcan(adept logic)....lol Thanks Mate

Share this post


Link to post
Share on other sites

VenusProject2,

Glad I could help. Live long and prosper.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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

  • Similar Content

    • Jibberish
      By Jibberish
      Hi,
      I am automating the testing of a video player. I search a file for ".mp4" and want to create a GUI with radio buttons to select what video to play. The number of videos can change based on the user's library so this must be created automatically.  I have searched for how to accomplish this and there are several posts out there that help a little but I can't figure out the solution. I pulled the offending code from my main script and created the file below to make this easier to read. I am sure one of our experts here can help!
      #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <array.au3> #include <File.au3> #include <GUIConstantsEx.au3> Local $sMediaFile = "D:\MediaFiles\MediaFiles.txt" Local $iStrReturn = 0 Local $aText Local $aArrayFile Local $iMax = 6 ;Default number of Videos - 1 for the array counter Local $aVideoName[$iMax] = [0] Local $sCheckBox1 Local $iT = 0, $iVideoCount = 0, $iCount Local $ix = 0 Local $iy = 0 Local $idClose1 Const $iL = 10 ; Count from Left for GUI so all buttons line up ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Read a list of video file names and create a GUI with Radio Buttons to select a single video. ; Problem: We don't know how many video names will be in the text file, so we can't hard code Case Statements & their variables ; Put the Video File Names into an Array _FileReadToArray($sMediaFile, $aArrayFile) For $a = 1 To $aArrayFile[0] ; Step through the array looking for .mp4 If StringInStr($aArrayFile[$a], ".mp4") Then $iVideoCount = $iVideoCount + 1 $aText = StringSplit($aArrayFile[$a],"\\") ; This video player reads double backslashes For $a1 = 1 to $aText[0] ; Check that the array is big enough If StringInStr($aText[$a1], ".mp4") Then ;MsgBox(0,"","Video is " & $aText[$a1]) If UBound($aVideoName) = $iVideoCount Then ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ReDim $aVideoName[$aVideoName[0] + $iMax] EndIf $aVideoName[$iVideoCount] = $aText[$a1]; add data to new index element $aVideoName[0] = $a1 ; update the index count for future reference ; The idea is to create a GUI width to accommodate long video file names $it = StringLen($aVideoName[$iVideoCount]) If $iT > $ix Then $ix = $iT EndIf EndIf Next EndIf Next ; Move backwards through the array deleting blank rows For $iCount = UBound($aVideoName) - 1 To 0 Step -1 If $aVideoName[$iCount] = "" Then _ArrayDelete($aVideoName, $iCount) EndIf Next ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Create the GUI - Names and Radio Button counts will vary - How do I do this? ; ;_ArrayDisplay($aVideoName) ;Local $aVarName[$aVideoName[0]] Local $iRows = UBound($aVideoName, $UBOUND_ROWS) $iRows = $iRows -1 $aVideoName[0] = $iRows ; Prep the GUI to display the FileNames with Radio Buttons - Can only select one at a time. $a = 0 $ix = $ix + 200 $iy = ($aVideoName[0] * 30) + 60 $hGUI = GUICreate("Videos", $ix, $iy) ;$iT = $iT+30 ; Create the variable names for the Case statement - Video count may change so Video Names displayed and GUICtrlCreateRadio count may change. ;~ For $a = 1 to $aVarName[0] ;~ If UBound($aVarName) = $aVarName Then ;~ ; Resize the array when $iCount is equal to the element count in the array to prevent subscript error ;~ ReDim $aVarName[$aVarName[0] + $iMax] ;~ EndIf ;~ Assign("$bVideoName" & $a, $a) ;~ Local $aVarName[$a] = Eval($bVideoName[$a]) ;~ ; $aVarName[$a] = GUICtrlCreateRadio($aVarName[$a], $iL, $iT) ;~ Next $iCount = 1 ;MsgBox(0,"","VideoName[0] is "&$aVideoName[0]) ;_ArrayDisplay($aVideoName) Local $bVideoName1 If $iCount < $aVideoName[0] Then $bVideoName1 = GUICtrlCreateRadio($aVideoName[$iCount], $iL, $iT) GUICtrlSetState($bVideoName1, $GUI_CHECKED) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName2 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName3 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0]) Then Local $bVideoName4 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName5 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName6 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iCount = $iCount + 1 If $iCount <= ($aVideoName[0] -1) Then Local $bVideoName7 = GUICtrlCreateRadio($aVideoName[$iCount],$iL,$iT) $iT = $iT+30 EndIf $iT = $iT + 30 $idClose1 = GUICtrlCreateButton("Go!", $iL, $iT) GUISetState(@SW_SHOW) ;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ; ; Switch Statement ; ;Local $nMsg = "" While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $bVideoName1 Case $bVideoName2 Case $bVideoName3 Case $bVideoName4 Case $bVideoName5 ;Case $bVideoName6 <- Fails because there are only 5 videos - Need variable $bVideoNames ;Case $bVideoName7 <- Fails because there are only 5 videos Case $idClose1 $bVideoName1 = GUICtrlRead($bVideoName1) $bVideoName2 = GUICtrlRead($bVideoName2) $bVideoName3 = GUICtrlRead($bVideoName3) $bVideoName4 = GUICtrlRead($bVideoName4) $bVideoName5 = GUICtrlRead($bVideoName5) ;$bVideoName6 = GUICtrlRead($bVideoName6) ;$bVideoName7 = GUICtrlRead($bVideoName7) ExitLoop EndSwitch WEnd GUIDelete($nMsg) MsgBox(0,"","Case " & $nMsg & " was selected.") ; Always returns 8. ??? This is the "MediaFiles.txt" file I am reading:
      D:\\MediaFiles\\BigBuckBunny.mp4 D:\\MediaFiles\\BigBuckBunny60fps.mp4 D:\\MediaFiles\\Sintel.mp4 D:\\MediaFiles\\sintel-2048-surround.mp4 D:\\MediaFiles\\TearsOfSteel.mp4 D:\\MediaFiles\\tearsofsteel_4K.mp4 I'm sure I have several mistakes (or poor coding methods) in my AutoIt file.
    • Skeletor
      By Skeletor
      Hi All,
      I know many newbies search for this feature.
      I decided to share this piece of code with everyone.
      Basically its a "splash screen" that has a transparent image.
      In a nutshell - Gui with a transparent gif.
      Enjoy...
      Download attachment....
       
      Splash Screen GUI.zip
    • Skeletor
      By Skeletor
      Hi Developers,
       
      While trying to find a way to actually style/skin the GUICtrlCreateTabItem, I read the help file and stated:
      My question to you guys is will this be updated? or am I hoping for something that will never come to pass?
      I've seen scripts between 2007 to 2009 allowing the tabs to be modified
      Reason for my question is I'm trying to make my GUI Tabs look more modern.
      Thanks in advance for reading my post.
       
    • Jibberish
      By Jibberish
      I am trying to get the results of a radio button selection. I have tried implementing sample scripts but to no avail.
      Can someone tell / show me what I am doing wrong?
      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> Local $bSelect1 Local $bSelect2 Local $bSelect3 SelectButton() ;The results of SelectButton is not being returned MsgBox(0,"","Select1 is "& $bSelect1 & ". Select2 is "& $bSelect2 & ". Select3 is "& $bSelect3 & ".") Func SelectButton() Local $hGUI = GUICreate("SGX4CP Tests", 300, 300) GUISetState() Local $bSelect1 = GUICtrlCreateRadio("Select 1", 10, 160) Local $bSelect2 = GUICtrlCreateRadio("Select 2", 10, 190) Local $bSelect3 = GUICtrlCreateRadio("Select 3", 10, 220) ; Set TestSelectForever as the default radio button GUICtrlSetState($bSelect1, $GUI_CHECKED) Local $idClose = GUICtrlCreateButton("Start", 120,250) Local $idMsg While 1 $idMsg = GUIGetMsg() Select Case $idMsg = $GUI_EVENT_CLOSE Or $idMsg = $idClose ExitLoop Case $idMsg = $bSelect1 And BitAND(GUICtrlRead($bSelect1), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select1") Case $idMsg = $bSelect2 And BitAND(GUICtrlRead($bSelect2), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select2") Case $idMsg = $bSelect3 And BitAND(GUICtrlRead($bSelect3), $GUI_CHECKED) = $GUI_CHECKED MsgBox(0,"","Select3") ; GUICtrlRead($hGUI) EndSelect WEnd MsgBox(0,"","Select1 is "& $bSelect1 & ". Select2 is "& $bSelect2 & ". Select3 is "& $bSelect3 & ".") ; Why is this returning numbers? EndFunc  
    • VIP
      By VIP
      Please help create a GUI! Any ideas or guides are welcome!

      Create drag-and-drop GUIs:
      - GUI Min or Explan Main GUI Menu with top button! (Also the button to move drag and drop move)
      - Main GUI Menu: Stay in the center of the screen AND Always on the left or right side of the screen!
      - When you click on one of the menus, you will create or create a GUI: always on the left or right side of the main menu!


       
      SRC:
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <ColorConstantS.au3> Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Opt("TrayMenuMode", 1) ;0=append, 1=no default menu, 2=no automatic check, 4=menuitemID not return Opt("TrayAutoPause", 0) ;0=no pause, 1=Pause Opt("GUIOnEventMode", 1) ;0=disabled, 1=OnEvent mode enabled Opt("GUIResizeMode", 0) ;0=no resizing, <1024 special resizing #Region ### START Koda GUI section ### Form= Global $Form1 = GUICreate("MAIN_MENU", 117, 481, @DesktopWidth - 117, -1, $WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") GUISetBkColor($COLOR_BLUE) ; will change background color Global $Label1 = GUICtrlCreateLabel("<-!->", 0, 0, 116, 25, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) Global $Button0 = GUICtrlCreateButton("Button0", 1, 32, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button0") Global $Button1 = GUICtrlCreateButton("Button1", 1, 73, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button1") Global $Button2 = GUICtrlCreateButton("Button2", 1, 119, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button2") Global $Button3 = GUICtrlCreateButton("Button3", 1, 167, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button3") Global $Button4 = GUICtrlCreateButton("Button4", 1, 216, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button4") Global $Button5 = GUICtrlCreateButton("Button5", 1, 259, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button5") Global $Button6 = GUICtrlCreateButton("Button6", 1, 305, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button6") Global $Button7 = GUICtrlCreateButton("Button7", 1, 347, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button7") Global $Button8 = GUICtrlCreateButton("Button8", 1, 396, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button8") Global $Button9 = GUICtrlCreateButton("Exit", 1, 437, 115, 41, BitOR($BS_CENTER, $BS_VCENTER, $BS_FLAT)) GUICtrlSetOnEvent(-1, "_Button9") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 Sleep(50) WEnd Func _Exit() Exit EndFunc ;==>_Exit Func _CloseGUI() GUIDelete() EndFunc ;==>_CloseGUI Func _Button0() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_0", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 0", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button0 Func _Button1() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_1", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 1", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button1 Func _Button2() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_2", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 2", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button2 Func _Button3() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_3", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 3", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button3 Func _Button4() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_4", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 4", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button4 Func _Button5() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_5", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 5", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button5 Func _Button6() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_6", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 6", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button6 Func _Button7() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_7", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 7", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button7 Func _Button8() #Region ### START SUB GUI section ### Form= Global $Form2 = GUICreate("SUB_GUI_8", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) GUISetBkColor($COLOR_RED) ; will change background color Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 8", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) GUICtrlSetOnEvent(-1, "_CloseGUI") GUISetState(@SW_SHOW) #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button8 Func _Button9() _Exit() ;~ #Region ### START SUB GUI section ### Form= ;~ Global $Form2 = GUICreate("SUB_GUI_9", 310, 712, @DesktopWidth - 310 - 150, -1, -1, BitOR($WS_EX_ACCEPTFILES, $WS_EX_TOPMOST, $WS_EX_WINDOWEDGE)) ; GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") ;~ Global $Label1 = GUICtrlCreateLabel("SUB GUI MENU 9", 0, 0, 234, 508, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_RIGHTJUST), $GUI_WS_EX_PARENTDRAG) ;~ GUICtrlSetFont(-1, 15, 400, 0, "MS Sans Serif") ;~ Global $Button1 = GUICtrlCreateButton("Exit", 240, 456, 67, 49, BitOR($BS_CENTER, $BS_VCENTER)) ;~ GUICtrlSetOnEvent(-1, "_CloseGUI") ;~ GUISetState(@SW_SHOW) ;~ #EndRegion ### START SUB GUI section ### Form= EndFunc ;==>_Button9