Jump to content

list control fill with array


Recommended Posts

CODE
$var = DriveGetDrive( "all" )

If NOT @error Then

MsgBox(4096,"", "Found " & $var[0] & " drives")

For $i = 1 to $var[0]

MsgBox(4096,"Drive " & $i, $var[$i])

Next

EndIf

; LIST

GuiCtrlCreateList("", 5, 190, 100, 90)

GuiCtrlSetData(-1, "item", "item")

this is my code, i want to view all my drives in a listbox.

I have all my drives in an array, and i want that array to be the source-data for my list-control.

how do i have to work?

Link to comment
Share on other sites

$var = DriveGetDrive( "all" )
If NOT @error Then
    MsgBox(4096,"", "Found " & $var[0] & " drives")
    For $i = 1 to $var[0]
        MsgBox(4096,"Drive " & $i, $var[$i])
    Next
EndIf

; LIST
GuiCtrlCreateList("", 5, 190, 100, 90)
GuiCtrlSetData(-1, "item", "item")

this is my code, i want to view all my drives in a listbox.

I have all my drives in an array, and i want that array to be the source-data for my list-control.

how do i have to work?

Just put GuiCtrlSetData() in a loop, the same way you did the "Drive" MsgBox().

:P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

CODE
$var = DriveGetDrive( "all" )

If NOT @error Then

MsgBox(4096,"", "Found " & $var[0] & " drives")

For $i = 1 to $var[0]

MsgBox(4096,"Drive " & $i, $var[$i])

Next

EndIf

; LIST

GuiCtrlCreateList("", 5, 190, 100, 90)

GuiCtrlSetData(-1, "item", "item")

this is my code, i want to view all my drives in a listbox.

I have all my drives in an array, and i want that array to be the source-data for my list-control.

how do i have to work?

Have a look at th eexample in the help for a list view.

EDIT: as PsaltyDS says or like this.

$gui = GUICreate("list Drives", 200, 300, 200, 200)
; LIST
$lv = GUICtrlCreateList("", 5, 190, 100, 90)
GUISetState()
$listData = ""
$var = DriveGetDrive("all")
If Not @error Then
    MsgBox(4096, "", "Found " & $var[0] & " drives")
    For $i = 1 To $var[0]
        MsgBox(4096, "Drive " & $i, $var[$i])
        $listData &= $var[$i] & '|'
    Next
EndIf


GUICtrlSetData($lv, $listData)

While GUIGetMsg() <> -3
    
WEnd
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
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...