spudw2k Posted April 11, 2017 Posted April 11, 2017 Using your arrays Global $sList1 = "" Global $aArray0[5] = [1,2,3,4,5] ;VALUE LIST0 Global $aArray1[5] = [6,7,8,9,10] ;VALUE LIST1 If GUICtrlRead($Box1) = $GUI_CHECKED Then $sList1 = "" For $i = 0 To UBound($aArray0) - 1 $sList1 &= "|" & $aArray0[$i] Next EndIf If GUICtrlRead($Box2) = $GUI_CHECKED Then $sList1 = "" For $i = 0 To UBound($aArray1) - 1 $sList1 &= "|" & $aArray1[$i] Next EndIf Or using a modular function Global $sList1 = "" Global $aArray0[5] = [1,2,3,4,5] ;VALUE LIST0 Global $aArray1[5] = [6,7,8,9,10] ;VALUE LIST1 If GUICtrlRead($Box1) = $GUI_CHECKED Then $sList1 = SetList($aArray0) If GUICtrlRead($Box2) = $GUI_CHECKED Then $sList1 = SetList($aArray1) Function SetList($aArray) If Not UBound($aArray) Then Return "" Local $sList = "" For $i = 0 To UBound($aArray) - 1 $sList &= "|" & $aArray[$i] Next Return $sList EndFunction many ways to skin this cat Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
antonioj84 Posted April 11, 2017 Posted April 11, 2017 thanks so much spudw2k that is exactly what I wanted the modular function
antonioj84 Posted April 11, 2017 Posted April 11, 2017 (edited) expandcollapse popup#include <GUIConstantsEx.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 255, 253, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 40, 48, 65, 17) ; IF RADIO1 SELECTED LIST0 IS SELECTED $Radio2 = GUICtrlCreateRadio("Radio2", 128, 48, 65, 17) ;IF RADIO2 SELECTED LIST1 IS SELECTED $Group1 = GUICtrlCreateGroup("POS", 24, 24, 177, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) ;GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $sList1 = "" Global $aArray0[5] = [1,2,3,4,5] ;VALUE LIST0 Global $aArray1[5] = [6,7,8,9,10] ;VALUE LIST1 Global $hCombo = GUICtrlCreateCombo("", 100, 148, 153, 25) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio1 If GUICtrlRead($Radio1) = $GUI_CHECKED Then $sList1 = SetList($aArray0) GUICtrlSetData($hCombo, $sList1) case $Radio2 If GUICtrlRead($Radio2) = $GUI_CHECKED Then $sList1 = SetList($aArray1) GUICtrlSetData($hCombo, $sList1) EndSwitch WEnd Func SetList($aArray) If Not UBound($aArray) Then Return "" Local $sList = "" For $i = 0 To UBound($aArray) - 1 $sList &= "|" & $aArray[$i] Next Return $sList EndFunc Edited April 11, 2017 by antonioj84 error
antonioj84 Posted April 11, 2017 Posted April 11, 2017 expandcollapse popup#include <GUIConstantsEx.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 255, 253, 192, 124) $Radio1 = GUICtrlCreateRadio("Radio1", 40, 48, 65, 17) ; IF RADIO1 SELECTED LIST0 IS SELECTED $Radio2 = GUICtrlCreateRadio("Radio2", 128, 48, 65, 17) ;IF RADIO2 SELECTED LIST1 IS SELECTED $Group1 = GUICtrlCreateGroup("POS", 24, 24, 177, 49) GUICtrlCreateGroup("", -99, -99, 1, 1) ;GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $sList1 = "" Global $aArray0[5] = [1,2,3,4,5] ;VALUE LIST0 Global $aArray1[5] = [6,7,8,9,10] ;VALUE LIST1 $hCombo = GUICtrlCreateCombo("", 100, 148, 153, 25) ; And fill it GUICtrlSetData($hCombo, $sList1) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Radio1 If GUICtrlRead($Radio1) = $GUI_CHECKED Then $sList1 = "" For $i = 0 To UBound($aArray0) - 1 $sList1 &= "|" & $aArray0[$i] GUICtrlSetData($hCombo, $sList1) ;fill it Next EndIf Case $Radio2 If GUICtrlRead($Radio2) = $GUI_CHECKED Then $sList1 = "" For $i = 0 To UBound($aArray1) - 1 $sList1 &= "|" & $aArray1[$i] GUICtrlSetData($hCombo, $sList1) ; fill it Next EndIf EndSwitch WEnd
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now