Edit:
Braucht wohl niemand, ich füge aber unten trotzdem mal 2 neue Versionen hinzu. eine mit #include <Array.au3>, die andere basiert auf StringSplit.
=========
Hey, ich habe eine kleine Funktion geschrieben, welche es einem erlaubt,
bis zu 10 Steuerelemente (erweiterbar) auf einmal für GUICtrlSetState ( controlID, state ) aufzurufen.
Z.B
4 Button deaktivieren und wieder aktivieren.
_MultiGSetState("D", $Button1, $Button2, $Button3, $Button4)
Sleep(5000)
_MultiGSetState("E", $Button1, $Button2, $Button3, $Button4)
Möglich sind die Aufrufe:
"Show" - "Hide" - "Enable" - "Disable" - "CHECKED" - "UNCHECKED"
oder die Kurzform
"S" - "H" - "E" - "D" - "CH" - "UN"
Man könnte auch einfach die Hilfsfunktion __GSetState() aufrufen, dann aber z.B. so __GSetState($GUI_DISABLE, $Button1, $Button2, $Button3, $Button4)
Ich hoffe, das es jemand nützlich findet.
so long
Frank
Spoiler anzeigen
;==========================================================================================
; Function : _MultiGSetState( state, controlID_1....controlID_10)
; Description : Changes the state of a control. / GUICtrlSetState
; Author : Thunder-man (Frank Michalski)
; Date - Version : 21. September 2007 - V 1.00
; Parameter : state = "Show" - "Hide" - "Enable" - "Disable" - "CHECKED" - "UNCHECKED"
; Example : : Enable four Button
; _MultiGSetState("E", $Button1, $Button2, $Button3, $Button4)
;==========================================================================================
Func _MultiGSetState($sGState , $ID1="", $ID2="", $ID3="", $ID4="", $ID5="", $ID6="", $ID7="", $ID8="", $ID9="", $ID10="")
Local $0
Switch $sGState
Case $sGState = "Show" or $sGState = "S"
$0 = __GSetState($GUI_SHOW, $ID1, $ID2, $ID3, $ID4, $ID5, $ID6, $ID7, $ID8, $ID9, $ID10)
Case $sGState = "Hide" or $sGState = "H"
$0 = __GSetState($GUI_HIDE, $ID1, $ID2, $ID3, $ID4, $ID5, $ID6, $ID7, $ID8, $ID9, $ID10)
Case $sGState = "Enable" or $sGState = "E"
$0 = __GSetState($GUI_ENABLE, $ID1, $ID2, $ID3, $ID4, $ID5, $ID6, $ID7, $ID8, $ID9, $ID10)
Case $sGState = "Disable" or $sGState = "D"
$0 = __GSetState($GUI_DISABLE, $ID1, $ID2, $ID3, $ID4, $ID5, $ID6, $ID7, $ID8, $ID9, $ID10)
Case $sGState = "CHECKED" or $sGState = "CH"
$0 = __GSetState($GUI_CHECKED, $ID1, $ID2, $ID3, $ID4, $ID5, $ID6, $ID7, $ID8, $ID9, $ID10)
Case $sGState = "UNCHECKED" or $sGState = "UN"
$0 = __GSetState($GUI_UNCHECKED, $ID1, $ID2, $ID3, $ID4, $ID5, $ID6, $ID7, $ID8, $ID9, $ID10)
Case Else
$0 = $sGState
EndSwitch
Return $0
EndFunc
Func __GSetState($s_GState,$ID_1="",$ID_2="",$ID_3="",$ID_4="",$ID_5="",$ID_6="",$ID_7="",$ID_8="",$ID_9="",$ID_10="")
;...It is used from _MultiGSetState()...; "Changes the state of a control"...; By Thunder-man
Local $sState
If Not $ID_1 = "" Then GUICtrlSetState($ID_1 , $s_GState)
If Not $ID_2 = "" Then GUICtrlSetState($ID_2 , $s_GState)
If Not $ID_3 = "" Then GUICtrlSetState($ID_3 , $s_GState)
If Not $ID_4 = "" Then GUICtrlSetState($ID_4 , $s_GState)
If Not $ID_5 = "" Then GUICtrlSetState($ID_5 , $s_GState)
If Not $ID_6 = "" Then GUICtrlSetState($ID_6 , $s_GState)
If Not $ID_7 = "" Then GUICtrlSetState($ID_7 , $s_GState)
If Not $ID_8 = "" Then GUICtrlSetState($ID_8 , $s_GState)
If Not $ID_9 = "" Then GUICtrlSetState($ID_9 , $s_GState)
If Not $ID_10 = "" Then GUICtrlSetState($ID_10 , $s_GState)
EndFunc
;==========================================================================================
Array Version:
Die Anzahl der Control´s ist nun nur durch dem Array begrenzt (21)
Beispiel:
#include <Array.au3>
_MultiGSetState("D", _ArrayCreate($los, $Btn_switch, $Btn_Entry, $Btn_save_all))
Spoiler anzeigen
;==========================================================================================
; Function : _MultiGSetState("state", _ArrayCreate( controlID_1, controlID_2 ...))
; Description : Changes the state of a control. / GUICtrlSetState
; Author : Thunder-man (Frank Michalski)
; Date - Version : 24. September 2007 - V 1.00 A
; Parameter : state = "Show" - "Hide" - "Enable" - "Disable" - "CHECKED" - "UNCHECKED"
; Example : : Enable four Button
; _MultiGSetState("E", _ArrayCreate($Button1, $Button2, $Button3, $Button4))
;==========================================================================================
Func _MultiGSetState($sGState, $GUICArr)
Local $0
Switch $sGState
Case $sGState = "Show" or $sGState = "S"
$0 = __GSetState($GUI_SHOW, $GUICArr)
Case $sGState = "Hide" or $sGState = "H"
$0 = __GSetState($GUI_HIDE, $GUICArr)
Case $sGState = "Enable" or $sGState = "E"
$0 = __GSetState($GUI_ENABLE, $GUICArr)
Case $sGState = "Disable" or $sGState = "D"
$0 = __GSetState($GUI_DISABLE, $GUICArr)
Case $sGState = "CHECKED" or $sGState = "CH"
$0 = __GSetState($GUI_CHECKED, $GUICArr)
Case $sGState = "UNCHECKED" or $sGState = "UN"
$0 = __GSetState($GUI_UNCHECKED, $GUICArr)
Case Else
$0 = $sGState
EndSwitch
Return $0
EndFunc
Func __GSetState($sGState, $GUICArr)
;...It is used from _MultiGSetState()...; "Changes the state of a control"...; By Thunder-man
Local $state = $sGState
For $i=0 to UBound($GUICArr) -1 Step 1
GuiCtrlSetState( $GUICArr[$i], $state)
Next
EndFunc
;==========================================================================================
StringSplit Version:
Allerdings ist der Aufruf der Funktion anders.
Es wird der Rückgabe Wert der controlID übergeben.
z.B
$Button1 = GUICtrlCreateButton("Übernehmen", 112, 301, 73, 25, 0)
Rückgabewert: (ID)
MsgBox(64, "", $Button1)
Oder mit Au3Info ermitteln.
Dann z.B 5 Control Elemente disabeln
_MultiGSetState("D", "10, 12, 15, 26, 27")
Spoiler anzeigen
;==========================================================================================
; Function : _MultiGSetState("state", "controlID_1, controlID_2, controlID_2")
; Description : Changes the state of a control. / GUICtrlSetState
; Author : Thunder-man (Frank Michalski)
; Date - Version : 24. September 2007 - V 1.00 S
; Parameter : state = "Show" - "Hide" - "Enable" - "Disable" - "CHECKED" - "UNCHECKED"
; Example : : Enable four Button
; _MultiGSetState("E", "10, 12, 15, 26, 27")
;==========================================================================================
Func _MultiGSetState($sGState, $GUICSplitt)
Local $0
Switch $sGState
Case $sGState = "Show" or $sGState = "S"
$0 = __GSetState($GUI_SHOW, $GUICSplitt)
Case $sGState = "Hide" or $sGState = "H"
$0 = __GSetState($GUI_HIDE, $GUICSplitt)
Case $sGState = "Enable" or $sGState = "E"
$0 = __GSetState($GUI_ENABLE, $GUICSplitt)
Case $sGState = "Disable" or $sGState = "D"
$0 = __GSetState($GUI_DISABLE, $GUICSplitt)
Case $sGState = "CHECKED" or $sGState = "CH"
$0 = __GSetState($GUI_CHECKED, $GUICSplitt)
Case $sGState = "UNCHECKED" or $sGState = "UN"
$0 = __GSetState($GUI_UNCHECKED, $GUICSplitt)
Case Else
$0 = $sGState
EndSwitch
Return $0
EndFunc
Func __GSetState($sGState, $GUICSplitt)
;~ ;...It is used from _MultiGSetState()...; "Changes the state of a control"...; By Thunder-man
Local $state = $sGState
$Splitt = StringSplit($GUICSplitt, ",")
For $i=1 to $Splitt[0] step 1
GUICtrlSetState($Splitt[$i], $state)
Next
EndFunc
;==========================================================================================