d0n Posted July 28, 2009 Share Posted July 28, 2009 I was wonder how do i set data for a large array like this Me 123 You 321 Jon 3000 Mike 940 i am not sure how to set the data of the whole array, do i have to do this 1 by 1? expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 308, 277, 302, 218) $Tab1 = GUICtrlCreateTab(8, 8, 289, 257) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Input1 = GUICtrlCreateInput("Input1", 24, 72, 121, 21) $Combo1 = GUICtrlCreateCombo("Combo1", 24, 40, 145, 25) $Button1 = GUICtrlCreateButton("Button1", 208, 40, 75, 25, $WS_GROUP) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlSetState(-1,$GUI_SHOW) $Label1 = GUICtrlCreateEdit("Label1", 16, 40, 180, 217, BitOR($SS_SUNKEN,$WS_VSCROLL)) $Button2 = GUICtrlCreateButton("Button2", 208, 40, 75, 25, $WS_GROUP) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Dim $avArray2[2][2] = [["1","23"],["3","21"]] Gui() Func Gui() GUICtrlSetOnEvent($Button2, "array1") GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") ; Just idle around While 1 Sleep(10) WEnd EndFunc Func array1() GUICtrlSetData($Label1, $avArray2) Endfunc Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>SpecialEvents Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 28, 2009 Moderators Share Posted July 28, 2009 d0n,If you want to display an array, your best choice is a ListView - then you can use a loop to fill in the lines. Look here:expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <TabConstants.au3> #include <WindowsConstants.au3> #include <GUIListView.au3> ; <<<<<<<<<< Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 308, 277, 302, 218) $Tab1 = GUICtrlCreateTab(8, 8, 289, 257) GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) $TabSheet1 = GUICtrlCreateTabItem("TabSheet1") $Input1 = GUICtrlCreateInput("Input1", 24, 72, 121, 21) $Combo1 = GUICtrlCreateCombo("Combo1", 24, 40, 145, 25) $Button1 = GUICtrlCreateButton("Button1", 208, 40, 75, 25, $WS_GROUP) $TabSheet2 = GUICtrlCreateTabItem("TabSheet2") GUICtrlSetState(-1,$GUI_SHOW) $hListView1 = GUICtrlCreateListView("_|_", 16, 40, 180, 217, $LVS_NOCOLUMNHEADER) ; <<<<<<<<<< _GUICtrlListView_SetColumnWidth(-1, 0, 90) ; <<<<<<<<<< _GUICtrlListView_SetColumnWidth(-1, 1, $LVSCW_AUTOSIZE_USEHEADER ) ; <<<<<<<<<< $Button2 = GUICtrlCreateButton("Button2", 208, 40, 75, 25, $WS_GROUP) GUICtrlCreateTabItem("") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $avArray2[2][2] = [["1","23"],["3","21"]] Gui() Func Gui() GUICtrlSetOnEvent($Button2, "array1") GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") ; Just idle around While 1 Sleep(10) WEnd EndFunc Func array1() For $i = 0 To UBound($avArray2) - 1 ; <<<<<<<<<< GUICtrlCreateListViewItem($avArray2[$i][0] & "|" & $avArray2[$i][1] , $hListView1) ; <<<<<<<<<< Next ; <<<<<<<<<< Endfunc Func SpecialEvents() Select Case @GUI_CtrlId = $GUI_EVENT_CLOSE Exit EndSelect EndFunc ;==>SpecialEventsI have marked the changed lines with : <<<<<<<<<< The Help file should explain the syntax, but ask if anything is unclear.M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
d0n Posted July 28, 2009 Author Share Posted July 28, 2009 thank you will try working at it >_ Link to comment Share on other sites More sharing options...
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