Jump to content

HELP OUTPUTTING AN ARRAY TO A GUI LIST


 Share

Recommended Posts

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)
Link to comment
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

Link to comment
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)
$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
Link to comment
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)
$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
Link to comment
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.
Link to comment
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]?

Link to comment
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

Link to comment
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.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...