Jump to content

Is there a way to run a function or subroutine when the Tab is clicked..


 Share

Recommended Posts

I have a two tab GUI.. one tab is called "StartUP" and the second tab is called "WindowControl"

Each time I click on the WindowControl tab I want the program to scan the desktop for windows and up date the tick boxes... A possible 16 tick boxes exist, but the program only displays a tick box if its specific window is out there in existence... So when I click the Window Control to see.. it could have from 0 to 16 radio boxes.. depending on how many windows are open.. Problem is it only scans the windows when the program is loaded. I need a way to detect anytime the "Windows Control tab is clicked and do an automatic scan for windows to up date the tick boxes... I could add a "Refresh" button to run the routine, but would prefer to have the update run when the Tab is clicked to view the status...

Bottom line... is there a command for onclick... like when the "Window Control" tab is cllicked the routine runs that updates the windows existing at that moment... The first code section is shown below that controls scanning the windows and works great.. Only problem is I will need to add a 'Refresh' button to be hit everytime I look at the tab.. unless there is a Tab onclick routine...

The entire code is in the second box if anyone want to see what it actually does... however unless you have some windows open by the name of 'Win 1' and Win 2' etc it won't do much for you...

All the IFs are simply to position the radio boxes across the screen when the are displayed.

GUICtrlCreateTabItem("Window Control")
For $i = 1 to 16
If WinExists('Win ' & $i) Then
  If $i = 1 then $t = 0
  If $i = 5 then $t = 0
  If $i = 9 then $t = 0
  If $i = 13 then $t = 0
  $t = $t + 60
  If $i = 1 then $v = 60
  If $i = 5 then $v = 80
  If $i = 9 then $v = 100
  If $i = 13 then $v = 120
     $radio[$i] = GUICtrlCreateCheckbox($i, $t, $v, 50, 20)
EndIf

Next

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/sf
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <DATE.au3>
Global $LblVer, $t, $v, $test, $radio[17]
Global $start, $mgs, $nrsecs, $i, $tot, $oIE
Global $mytime, $nrwins, $num, $secdelay, $file, $dog, $i, $sync, $cat
Global $cnt, $mynum, $test, $cver, $hver, $uver, $xver, $mode, $test, $cap, $rpt
Global $nrtorun, $mysound
HotKeySet("{ESC}", "Terminate")
$Form1_1 = GUICreate("Hud Alert Control Version " & $cver, 378, 303, 750, 0)
$LblVer = GUICtrlCreateLabel('UVER - ' & $uver & '   CVER - ' & $cver & '   HVER - ' & $hver & '  XVER - ' & $xver, 65, 285, 300, 17)
$Tab1 = GUICtrlCreateTab(16, 32, 337, 249)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)

$StartUp = GUICtrlCreateTabItem("StartUp")
$Group1 = GUICtrlCreateGroup("Start Up", 32, 72, 297, 185)
$Label1 = GUICtrlCreateLabel("Number of Instances to Run", 72, 136, 137, 17)
$nrtorun = GUICtrlCreateInput("8", 224, 136, 57, 21)
$Label2 = GUICtrlCreateLabel("Number of seconds apart ", 72, 176, 126, 17)
$nrsecs = GUICtrlCreateInput("30", 224, 176, 57, 21)

GUICtrlCreateTabItem("Window Control")
For $i = 1 to 16
If WinExists('Win ' & $i) Then
  If $i = 1 then $t = 0
  If $i = 5 then $t = 0
  If $i = 9 then $t = 0
  If $i = 13 then $t = 0
  $t = $t + 60
  If $i = 1 then $v = 60
  If $i = 5 then $v = 80
  If $i = 9 then $v = 100
  If $i = 13 then $v = 120
     $radio[$i] = GUICtrlCreateCheckbox($i, $t, $v, 50, 20)
EndIf

Next
;                                             L    T    W   H
$readone = GUICtrlCreateButton("Read One", 50, 160, 100, 25)
$tickone = GUICtrlCreateButton("Tick One", 200, 160, 100, 25)
$untickall = GUICtrlCreateButton("Untick All", 50, 200, 100, 25)
$tickall = GUICtrlCreateButton("Tick All", 200, 200, 100, 25)

GUISetState(@SW_SHOW)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $readone
            ; Read 1
            $i = 1
            $test = GUICtrlRead($radio[$i])
            MsgBox(0, "", "Radio 1 = " & $test)
        Case $msg = $tickone
            ; Tick 1
            $i = 1
            GUICtrlSetState($radio[$i], $GUI_CHECKED)
        Case $msg = $tickall
            ; Check all
            For $i = 1 To 16
                GUICtrlSetState($radio[$i], $GUI_CHECKED)
            Next
        Case $msg = $untickall
            ; Uncheck All
            For $i = 1 To 16
                GUICtrlSetState($radio[$i], $GUI_UNCHECKED)
            Next
    EndSelect

WEnd
Func Terminate()
    Exit
EndFunc   ;==>Terminate
Link to comment
Share on other sites

Just like this:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/sf
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <DATE.au3>
Global $LblVer, $t, $v, $test, $radio[17]
Global $start, $mgs, $nrsecs, $i, $tot, $oIE
Global $mytime, $nrwins, $num, $secdelay, $file, $dog, $i, $sync, $cat
Global $cnt, $mynum, $test, $cver, $hver, $uver, $xver, $mode, $test, $cap, $rpt
Global $nrtorun, $mysound
HotKeySet("{ESC}", "Terminate")
$Form1_1 = GUICreate("Hud Alert Control Version " & $cver, 378, 303, 750, 0)
$LblVer = GUICtrlCreateLabel('UVER - ' & $uver & '   CVER - ' & $cver & '   HVER - ' & $hver & '  XVER - ' & $xver, 65, 285, 300, 17)
$Tab1 = GUICtrlCreateTab(16, 32, 337, 249)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$StartUp = GUICtrlCreateTabItem("StartUp")
$Group1 = GUICtrlCreateGroup("Start Up", 32, 72, 297, 185)
$Label1 = GUICtrlCreateLabel("Number of Instances to Run", 72, 136, 137, 17)
$nrtorun = GUICtrlCreateInput("8", 224, 136, 57, 21)
$Label2 = GUICtrlCreateLabel("Number of seconds apart ", 72, 176, 126, 17)
$nrsecs = GUICtrlCreateInput("30", 224, 176, 57, 21)
GUICtrlCreateTabItem("Window Control")
For $i = 1 To 16
If WinExists('Win ' & $i) Then
  If $i = 1 Then $t = 0
  If $i = 5 Then $t = 0
  If $i = 9 Then $t = 0
  If $i = 13 Then $t = 0
  $t = $t + 60
  If $i = 1 Then $v = 60
  If $i = 5 Then $v = 80
  If $i = 9 Then $v = 100
  If $i = 13 Then $v = 120
  $radio[$i] = GUICtrlCreateCheckbox($i, $t, $v, 50, 20)
EndIf
Next
;                                            L    T    W   H
$readone = GUICtrlCreateButton("Read One", 50, 160, 100, 25)
$tickone = GUICtrlCreateButton("Tick One", 200, 160, 100, 25)
$untickall = GUICtrlCreateButton("Untick All", 50, 200, 100, 25)
$tickall = GUICtrlCreateButton("Tick All", 200, 200, 100, 25)
GUISetState(@SW_SHOW)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
; Run the GUI until the dialog is closed
$lastTab = -99
While 1
$activeTab = GUICtrlRead($Tab1)
If $activeTab <> $lastTab Then
  $lastTab = $activeTab
  If $activeTab = 1 Then MsgBox(0, "Tabclick", $activeTab) ;only Clicks of Tab 1
EndIf
$msg = GUIGetMsg()
Select
  Case $msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case $mgs = $Tab1
  Case $msg = $readone
   ; Read 1
   $i = 1
   $test = GUICtrlRead($radio[$i])
   MsgBox(0, "", "Radio 1 = " & $test)
  Case $msg = $tickone
   ; Tick 1
   $i = 1
   GUICtrlSetState($radio[$i], $GUI_CHECKED)
  Case $msg = $tickall
   ; Check all
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_CHECKED)
   Next
  Case $msg = $untickall
   ; Uncheck All
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_UNCHECKED)
   Next
EndSelect
WEnd
Func Terminate()
Exit
EndFunc   ;==>Terminate

Link to comment
Share on other sites

I use Tabbed pages quite a bit and found that this works pretty reliably, it is slightly different than AutoBert's example.

There are a few different ways to determine Active Tab, how you determine & act accordingly is relative to what you want to do with your application. You will see I added a ConsoleWrite which outputs the info used to determine which tab is active.

The Case Variation: I've also provided a commented Case option which will show you a very unpleasant side effect if not double tested.

Case Variation with SysInfo tab to preload example: I extended the example to show how the data preload can be done. It should be sufficient to show how this works.

The Variation on AutoBert's example: I added a test in there for msg=0 which is important to know if you want to populate data on startup and $msg is 0 @ initial start. See the comments in the script.

Case Variation:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/sf
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <DATE.au3>
Global $LblVer, $t, $v, $test, $radio[17]
Global $start, $mgs, $nrsecs, $i, $tot, $oIE
Global $mytime, $nrwins, $num, $secdelay, $file, $dog, $i, $sync, $cat
Global $cnt, $mynum, $test, $cver, $hver, $uver, $xver, $mode, $test, $cap, $rpt
Global $nrtorun, $mysound
HotKeySet("{ESC}", "Terminate")
$Form1_1 = GUICreate("Hud Alert Control Version " & $cver, 378, 303, 750, 0)
$LblVer = GUICtrlCreateLabel('UVER - ' & $uver & '   CVER - ' & $cver & '   HVER - ' & $hver & '  XVER - ' & $xver, 65, 285, 300, 17)
$Tab1 = GUICtrlCreateTab(16, 32, 337, 249)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$StartUp = GUICtrlCreateTabItem("StartUp")
$Group1 = GUICtrlCreateGroup("Start Up", 32, 72, 297, 185)
$Label1 = GUICtrlCreateLabel("Number of Instances to Run", 72, 136, 137, 17)
$nrtorun = GUICtrlCreateInput("8", 224, 136, 57, 21)
$Label2 = GUICtrlCreateLabel("Number of seconds apart ", 72, 176, 126, 17)
$nrsecs = GUICtrlCreateInput("30", 224, 176, 57, 21)
GUICtrlCreateTabItem("Window Control")
For $i = 1 To 16
If WinExists('Win ' & $i) Then
  If $i = 1 Then $t = 0
  If $i = 5 Then $t = 0
  If $i = 9 Then $t = 0
  If $i = 13 Then $t = 0
  $t = $t + 60
  If $i = 1 Then $v = 60
  If $i = 5 Then $v = 80
  If $i = 9 Then $v = 100
  If $i = 13 Then $v = 120
  $radio[$i] = GUICtrlCreateCheckbox($i, $t, $v, 50, 20)
EndIf
Next
;                                            L  T   W   H
$readone = GUICtrlCreateButton("Read One", 50, 160, 100, 25)
$tickone = GUICtrlCreateButton("Tick One", 200, 160, 100, 25)
$untickall = GUICtrlCreateButton("Untick All", 50, 200, 100, 25)
$tickall = GUICtrlCreateButton("Tick All", 200, 200, 100, 25)
GUISetState(@SW_SHOW)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
; Run the GUI until the dialog is closed
While 1
$activeTab = GUICtrlRead($Tab1) ; Get Tab State for checking which is active
$msg = GUIGetMsg()
Select
  Case $msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case ($msg = $Tab1) And ($activeTab = 0) ; First Tab is active
   ; Case $activeTab = 0 ; a Nasty way to do this, uncomment this, comment the above to test
   ; NOTE:  Double testing that msg is "Tab Selected"  AND "Which Tab" was selected
   ;        IF you skip this double test, the moment the Tab is activated, the case loop gets stuck (very bad)
   ;
   ; output to console the values of the variables tested against
   ConsoleWrite("$msg= " & $msg & " Tab data= " & GUICtrlRead($Tab1) & " Tab Data Extended= " & GUICtrlRead($Tab1, 1) & @CR)
   ;
  Case ($msg = $Tab1) And ($activeTab = 1) ; Second Tab is active
   ;
   ConsoleWrite("$msg= " & $msg & " Tab data= " & GUICtrlRead($Tab1) & " Tab Data Extended= " & GUICtrlRead($Tab1, 1) & @CR)
   ;
  Case $msg = $readone
   ; Read 1
   $i = 1
   $test = GUICtrlRead($radio[$i])
   MsgBox(0, "", "Radio 1 = " & $test)
  Case $msg = $tickone
   ; Tick 1
   $i = 1
   GUICtrlSetState($radio[$i], $GUI_CHECKED)
  Case $msg = $tickall
   ; Check all
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_CHECKED)
   Next
  Case $msg = $untickall
   ; Uncheck All
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_UNCHECKED)
   Next
EndSelect
WEnd
Func Terminate()
Exit
EndFunc   ;==>Terminate

Case Variation with System Info Tab that auto-loads:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/sf
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <DATE.au3>
#include <Inet.au3>    ; needed fr _GetIP etc
#include <String.au3>  ; needed for _StringInsert and other strig manipulations
Global $LblVer, $t, $v, $test, $radio[17]
Global $start, $mgs, $nrsecs, $i, $tot, $oIE
Global $mytime, $nrwins, $num, $secdelay, $file, $dog, $i, $sync, $cat
Global $cnt, $mynum, $test, $cver, $hver, $uver, $xver, $mode, $test, $cap, $rpt
Global $nrtorun, $mysound
; Sysinfo Variables
Global $Input_OPspack, $Input_OPsysVer, $Input_OParch, $Input_OPintIP, $Input_OPextIP, $Input_OPramAvail, $Input_OPSysRam
HotKeySet("{ESC}", "Terminate")
$Form1_1 = GUICreate("Hud Alert Control Version " & $cver, 400, 350, 750, 0)
$LblVer = GUICtrlCreateLabel('UVER - ' & $uver & '   CVER - ' & $cver & '   HVER - ' & $hver & '  XVER - ' & $xver, 65, 285, 300, 17)
$Tab1 = GUICtrlCreateTab(16, 32, 337, 249)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$StartUp = GUICtrlCreateTabItem("StartUp")
$Group1 = GUICtrlCreateGroup("Start Up", 32, 72, 297, 185)
$Label1 = GUICtrlCreateLabel("Number of Instances to Run", 72, 136, 137, 17)
$nrtorun = GUICtrlCreateInput("8", 224, 136, 57, 21)
$Label2 = GUICtrlCreateLabel("Number of seconds apart ", 72, 176, 126, 17)
$nrsecs = GUICtrlCreateInput("30", 224, 176, 57, 21)
GUICtrlCreateTabItem("Window Control")
For $i = 1 To 16
 If WinExists('Win ' & $i) Then
  If $i = 1 Then $t = 0
  If $i = 5 Then $t = 0
  If $i = 9 Then $t = 0
  If $i = 13 Then $t = 0
  $t = $t + 60
  If $i = 1 Then $v = 60
  If $i = 5 Then $v = 80
  If $i = 9 Then $v = 100
  If $i = 13 Then $v = 120
  $radio[$i] = GUICtrlCreateCheckbox($i, $t, $v, 50, 20)
 EndIf
Next
;                                            L    T    W   H
$readone = GUICtrlCreateButton("Read One", 50, 160, 100, 25)
$tickone = GUICtrlCreateButton("Tick One", 200, 160, 100, 25)
$untickall = GUICtrlCreateButton("Untick All", 50, 200, 100, 25)
$tickall = GUICtrlCreateButton("Tick All", 200, 200, 100, 25)
GUICtrlCreateTabItem("System Information") ; Informational, Input set as READONLY
Local $Label_OPsysVer = GUICtrlCreateLabel("Operating System:", 24, 68, 93, 17)
Local $Label_OParch = GUICtrlCreateLabel("Architecture:", 24, 98, 67, 17)
Local $Label_OPspack = GUICtrlCreateLabel("Service Pack:", 24, 128, 71, 17)
Local $Label_OPintIP = GUICtrlCreateLabel("Internal IP:", 24, 158, 55, 17)
Local $Label_OPextIP = GUICtrlCreateLabel("External IP:", 24, 188, 58, 17)
Local $Label_OPramAvail = GUICtrlCreateLabel("Memory Available", 24, 248, 87, 17)
Local $Label_OPSysRam = GUICtrlCreateLabel("System Memory:", 24, 218, 81, 17)
$Input_OPspack = GUICtrlCreateInput("@OSServicePack", 124, 128, 121, 22, $ES_READONLY)
$Input_OPsysVer = GUICtrlCreateInput("@OSVersion", 124, 68, 121, 22, $ES_READONLY)
$Input_OParch = GUICtrlCreateInput("@OSArch", 124, 98, 121, 22, $ES_READONLY)
$Input_OPintIP = GUICtrlCreateInput("@IPAddress1", 124, 158, 121, 22, $ES_READONLY)
$Input_OPextIP = GUICtrlCreateInput("ExternalIP", 124, 188, 121, 22, $ES_READONLY)
$Input_OPramAvail = GUICtrlCreateInput("Ram Available", 124, 248, 121, 22, $ES_READONLY)
$Input_OPSysRam = GUICtrlCreateInput("System Ram", 124, 218, 121, 22, $ES_READONLY)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
; Run the GUI until the dialog is closed
While 1
 $activeTab = GUICtrlRead($Tab1) ; Get Tab State for checking which is active
 $msg = GUIGetMsg()
 Select
  Case $msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case ($msg = $Tab1) And ($activeTab = 0) ; First Tab is active
   ; Case $activeTab = 0 ; a Nasty way to do this, uncomment this, comment the above to test
   ; NOTE:  Double testing that msg is "Tab Selected"  AND "Which Tab" was selected
   ;        IF you skip this double test, the moment the Tab is activated, the case loop gets stuck (very bad)
   ;
   ; output to console the values of the variables tested against
   ConsoleWrite("$msg= " & $msg & " Tab data= " & GUICtrlRead($Tab1) & " Tab Data Extended= " & GUICtrlRead($Tab1, 1) & @CR)
   ;
  Case ($msg = $Tab1) And ($activeTab = 1) ; Second Tab is active
   ;
   ConsoleWrite("$msg= " & $msg & " Tab data= " & GUICtrlRead($Tab1) & " Tab Data Extended= " & GUICtrlRead($Tab1, 1) & @CR)
   ;
  Case ($msg = $Tab1) And ($activeTab = 2) ; Third Tab is active (SysInfo)
   ; updates system info every time the tab is selected.
   ConsoleWrite("$msg= " & $msg & " Tab data= " & GUICtrlRead($Tab1) & " Tab Data Extended= " & GUICtrlRead($Tab1, 1) & @CR)
   _SysInfo()
  Case $msg = $readone
   ; Read 1
   $i = 1
   $test = GUICtrlRead($radio[$i])
   MsgBox(0, "", "Radio 1 = " & $test)
  Case $msg = $tickone
   ; Tick 1
   $i = 1
   GUICtrlSetState($radio[$i], $GUI_CHECKED)
  Case $msg = $tickall
   ; Check all
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_CHECKED)
   Next
  Case $msg = $untickall
   ; Uncheck All
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_UNCHECKED)
   Next
 EndSelect
WEnd
; format the bytes to make more readable
Func _formatRam($tmpVal)
 $fullnum = String($tmpVal)
 Local $len = StringLen($fullnum)
 If $len > 3 Then $newVal = _StringInsert($tmpVal, ",", -3)
 If $len > 6 Then
  $fmtdVal = _StringInsert($newVal, ",", -7)
 Else
  $fmtdVal = $newVal
 EndIf
 Return $fmtdVal
EndFunc   ;==>_formatRam
; Get System Info & populate fields
Func _SysInfo()
 GUICtrlSetData($Input_OPspack, @OSServicePack)
 GUICtrlSetData($Input_OPsysVer, @OSVersion)
 GUICtrlSetData($Input_OParch, @OSArch)
 GUICtrlSetData($Input_OPintIP, @IPAddress1)
 GUICtrlSetData($Input_OPextIP, _GetIP())
 Local $mem = MemGetStats()
 GUICtrlSetData($Input_OPSysRam, _formatRam(String($mem[1])) & " Kb")
 GUICtrlSetData($Input_OPramAvail, _formatRam(String($mem[2])) & " Kb")
EndFunc   ;==>_SysInfo
Func Terminate()
 Exit
EndFunc   ;==>Terminate

Variation on AutoBert's example:

#region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Run_Tidy=y
#Tidy_Parameters=/sf
#endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <IE.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <DATE.au3>
Global $LblVer, $t, $v, $test, $radio[17]
Global $start, $mgs, $nrsecs, $i, $tot, $oIE
Global $mytime, $nrwins, $num, $secdelay, $file, $dog, $i, $sync, $cat
Global $cnt, $mynum, $test, $cver, $hver, $uver, $xver, $mode, $test, $cap, $rpt
Global $nrtorun, $mysound
HotKeySet("{ESC}", "Terminate")
$Form1_1 = GUICreate("Hud Alert Control Version " & $cver, 378, 303, 750, 0)
$LblVer = GUICtrlCreateLabel('UVER - ' & $uver & '   CVER - ' & $cver & '   HVER - ' & $hver & '  XVER - ' & $xver, 65, 285, 300, 17)
$Tab1 = GUICtrlCreateTab(16, 32, 337, 249)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$StartUp = GUICtrlCreateTabItem("StartUp")
$Group1 = GUICtrlCreateGroup("Start Up", 32, 72, 297, 185)
$Label1 = GUICtrlCreateLabel("Number of Instances to Run", 72, 136, 137, 17)
$nrtorun = GUICtrlCreateInput("8", 224, 136, 57, 21)
$Label2 = GUICtrlCreateLabel("Number of seconds apart ", 72, 176, 126, 17)
$nrsecs = GUICtrlCreateInput("30", 224, 176, 57, 21)
GUICtrlCreateTabItem("Window Control")
For $i = 1 To 16
If WinExists('Win ' & $i) Then
  If $i = 1 Then $t = 0
  If $i = 5 Then $t = 0
  If $i = 9 Then $t = 0
  If $i = 13 Then $t = 0
  $t = $t + 60
  If $i = 1 Then $v = 60
  If $i = 5 Then $v = 80
  If $i = 9 Then $v = 100
  If $i = 13 Then $v = 120
  $radio[$i] = GUICtrlCreateCheckbox($i, $t, $v, 50, 20)
EndIf
Next
;                                           L   T   W   H
$readone = GUICtrlCreateButton("Read One", 50, 160, 100, 25)
$tickone = GUICtrlCreateButton("Tick One", 200, 160, 100, 25)
$untickall = GUICtrlCreateButton("Untick All", 50, 200, 100, 25)
$tickall = GUICtrlCreateButton("Tick All", 200, 200, 100, 25)
GUISetState(@SW_SHOW)
GUICtrlCreateTabItem("")
GUISetState(@SW_SHOW)
; Run the GUI until the dialog is closed
$lastTab = -99
While 1
$activeTab = GUICtrlRead($Tab1)
$msg = GUIGetMsg()
;If $activeTab <> $lastTab Then ; this will excecute First Tab on start.  Good if you need to preload data to screen
If $activeTab <> $lastTab And $msg > 0 Then ; this will prevent First Tab on start.  $msg = 0 @ First Start, filter for it to preload
  $lastTab = $activeTab
  If $activeTab = 0 Then MsgBox(0, "Tabclick", $activeTab) ;Clicks Tab 1
  If $activeTab = 1 Then MsgBox(0, "Tabclick", $activeTab) ;Clicks Tab 2
  ConsoleWrite("$msg= " & $msg & " $activeTab = " & $activeTab & " Tab data= " & GUICtrlRead($Tab1) & " Tab Data Extended= " & GUICtrlRead($Tab1, 1) & @CR)
EndIf
Select
  Case $msg = $GUI_EVENT_CLOSE
   ExitLoop
  Case $mgs = $Tab1
  Case $msg = $readone
   ; Read 1
   $i = 1
   $test = GUICtrlRead($radio[$i])
   MsgBox(0, "", "Radio 1 = " & $test)
  Case $msg = $tickone
   ; Tick 1
   $i = 1
   GUICtrlSetState($radio[$i], $GUI_CHECKED)
  Case $msg = $tickall
   ; Check all
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_CHECKED)
   Next
  Case $msg = $untickall
   ; Uncheck All
   For $i = 1 To 16
    GUICtrlSetState($radio[$i], $GUI_UNCHECKED)
   Next
EndSelect
WEnd
Func Terminate()
Exit
EndFunc   ;==>Terminate

Hope it Helps

Edited by WhiteStar

~ WhiteStar Magic

Always tuned to http://www.superbluesradio.com/  Tune in at http://87.117.217.41:8036/

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