SteveO Posted August 15, 2007 Posted August 15, 2007 Okay, need help outputting my array to a GUI List. I can get everything to appear on the list, but it only appears on one line, if I try @LF to create a new line, it gets me one of those unknown char boxes instead of the new line. $arrayoutput = ($aMessages[1] & $aMessages[2] & $aMessages[3] & $aMessages[4]) $List2 = GUICtrlCreateList($arrayoutput, 376, 24, 225, 344)
randallc Posted August 15, 2007 Posted August 15, 2007 Okay, need help outputting my array to a GUI List. I can get everything to appear on the list, but it only appears on one line, if I try @LF to create a new line, it gets me one of those unknown char boxes instead of the new line. $arrayoutput = ($aMessages[1] & $aMessages[2] & $aMessages[3] & $aMessages[4]) $List2 = GUICtrlCreateList($arrayoutput, 376, 24, 225, 344)Hi, Use pipe separator; see Helpfile examples. Best, randall ExcelCOM... AccessCom.. Word2... FileListToArrayNew...SearchMiner... Regexps...SQL...Explorer...Array2D.. _GUIListView...array problem...APITailRW
narayanjr Posted August 15, 2007 Posted August 15, 2007 (edited) $arrayoutput = ($aMessages[1] & $aMessages[2] & $aMessages[3] & $aMessages[4]) $List2 = GUICtrlCreateList($arrayoutput, 376, 24, 225, 344) For $i = 0 to UBound($arrayoutput) - 1 GUICtrlSetData($List2 ,$arrayoutput [$i]) Next i think thats right Edited August 15, 2007 by narayanjr
SteveO Posted August 15, 2007 Author Posted August 15, 2007 Hi, Use pipe separator; see Helpfile examples.Best, randallI tried the pipe separator with and without quotes. Without I get an error, with it just shows up in the line.
SteveO Posted August 15, 2007 Author Posted August 15, 2007 $arrayoutput = ($aMessages[1] & $aMessages[2] & $aMessages[3] & $aMessages[4]) $List2 = GUICtrlCreateList($arrayoutput, 376, 24, 225, 344) For $i = 0 to UBound($arrayoutput) - 1 GUICtrlSetData($List2 ,$arrayoutput [$i]) Next i think thats right Hmmm....didn't seem to do anything.
narayanjr Posted August 15, 2007 Posted August 15, 2007 (edited) #include <GUIConstants.au3> #Include <File.au3> #Include <Array.au3> #Include <GUIConstants.au3> #Include <Constants.au3> #include <GuiCombo.au3> $Form1 = GUICreate("AForm1", 633, 447, 193, 115) $List1 = GUICtrlCreateList("", 40, 40, 169, 357) GUISetState(@SW_SHOW) $FileList = _FileListToArray(@DesktopDir) For $i = 1 To UBound($FileList) - 1 GUICtrlSetData($List1,$FileList[$i],"") Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Theres an example gl and i know this works i tested it Edited August 15, 2007 by narayanjr
SteveO Posted August 15, 2007 Author Posted August 15, 2007 (edited) #include <GUIConstants.au3> #Include <File.au3> #Include <Array.au3> #Include <GUIConstants.au3> #Include <Constants.au3> #include <GuiCombo.au3> $Form1 = GUICreate("AForm1", 633, 447, 193, 115) $List1 = GUICtrlCreateList("", 40, 40, 169, 357) GUISetState(@SW_SHOW) $FileList = _FileListToArray(@DesktopDir) For $i = 1 To UBound($FileList) - 1 GUICtrlSetData($List1,$FileList[$i],"") Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Theres an example gl and i know this works i tested it Yes, that scripts works. Just trying to get it to work with _FileReadtoArray EDIT... Yea...it just doesn't seem to work with _FileReadToArray, but when I replace the _FileReadToArray with _FileListToArray, it works perfectly... Edited August 15, 2007 by SteveO
bluebearr Posted August 15, 2007 Posted August 15, 2007 #include <GUIConstants.au3> #Include <File.au3> #Include <Array.au3> #Include <GUIConstants.au3> #Include <Constants.au3> #include <GuiCombo.au3> $Form1 = GUICreate("AForm1", 633, 447, 193, 115) $List1 = GUICtrlCreateList("", 40, 40, 169, 357) GUISetState(@SW_SHOW) Dim $FileList _FileReadToArray(@WindowsDir & "\win.ini", $FileList) $DataList = _ArrayToString($FileList, "|") GUICtrlSetData($List1,$DataList,"") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd BlueBearrOddly enough, this is what I do for fun.
SteveO Posted August 15, 2007 Author Posted August 15, 2007 #include <GUIConstants.au3> #Include <File.au3> #Include <Array.au3> #Include <GUIConstants.au3> #Include <Constants.au3> #include <GuiCombo.au3> $Form1 = GUICreate("AForm1", 633, 447, 193, 115) $List1 = GUICtrlCreateList("", 40, 40, 169, 357) GUISetState(@SW_SHOW) Dim $FileList _FileReadToArray(@WindowsDir & "\win.ini", $FileList) $DataList = _ArrayToString($FileList, "|") GUICtrlSetData($List1,$DataList,"") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd You are god... One thing though, can I get it to not output array[0]?
smashly Posted August 15, 2007 Posted August 15, 2007 Hi The reason your List isn't working: When you try to add a blank string to the list it actually clears the list.. a blank value in the array eg: "" used with GUICtrlSetData ()would be that same as GUICtrlSetData($List, "") , which means clear the list Filter out the blank data in the array ..eg:#include <GUIConstants.au3> #Include <File.au3> Global $FRTA $Form1 = GUICreate("AForm1", 633, 447, 193, 115) $List1 = GUICtrlCreateList("", 10, 10, 613, 427, BitOR($LBS_NOTIFY, $WS_VSCROLL, $WS_BORDER)) GUISetState(@SW_SHOW) _FileReadToArray(@ScriptDir & "\YourFileToRead.txt", $FRTA) For $i = 1 To $FRTA[0] If $FRTA[$i] <> "" Then GUICtrlSetData($List1, $FRTA[$i]) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd There's probably a few solutions to overcome your problem actually, depending if you actually want blank items in the List or not... Cheers
bluebearr Posted August 15, 2007 Posted August 15, 2007 Try this: #include <GUIConstants.au3> #Include <File.au3> #Include <Array.au3> #Include <GUIConstants.au3> #Include <Constants.au3> #include <GuiCombo.au3> $Form1 = GUICreate("AForm1", 633, 447, 193, 115) $List1 = GUICtrlCreateList("", 40, 40, 169, 357) GUISetState(@SW_SHOW) Dim $FileList _FileReadToArray(@WindowsDir & "\win.ini", $FileList) $DataList = _ArrayToString($FileList, "|", 1) GUICtrlSetData($List1,$DataList,"") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd BlueBearrOddly enough, this is what I do for fun.
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