Sign in to follow this  
Followers 0
placebo

list control fill with array

4 posts in this topic

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?

Share this post


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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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.

Share this post


Link to post
Share on other sites

thanks :-)

it works fine!

stupid question of me!

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