Sign in to follow this  
Followers 0
SteveO

HELP OUTPUTTING AN ARRAY TO A GUI LIST

12 posts in this topic

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)

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by narayanjr

Share this post


Link to post
Share on other sites

Hi, Use pipe separator; see Helpfile examples.

Best, randall

I tried the pipe separator with and without quotes. Without I get an error, with it just shows up in the line.


Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#6 ·  Posted (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 by narayanjr

Share this post


Link to post
Share on other sites

#7 ·  Posted (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 by SteveO

Share this post


Link to post
Share on other sites

Anyone else got any ideas?


Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

#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]?


Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0