Jump to content

Recommended Posts

Posted

three questions how do i add items to the list in the gui?

and how do i set thouse highlisted listed items to be a variable made by a button?

then can variables be used for a dir function? like dirmove ("$mydir", "$thatdir" [, 1] )

Posted (edited)

i looked in the beta help file and it seemed confusing. can you give me an example? please.

of _GUICtrlListGetSelItemsText

Edited by Raluvian
Posted

it provides an example in there...

#include <GUIConstants.au3>
#include <GuiList.au3>

Opt ('MustDeclareVars', 1)

Dim $msg, $ret
Dim $listbox, $button, $label, $i

GUICreate("ListBox Selected Items Text Demo", 400, 250, -1, -1)

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))
GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")
$button = GUICtrlCreateButton("Get Selected", 150, 160, 120, 40)

GUISetState()
While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $button
            $ret = _GUICtrlListGetSelItemsText ($listbox)
            If (Not IsArray($ret)) Then
                MsgBox(16, "Error", "Unknown error from _GUICtrlListGetSelItemsText")
            Else
                For $i = 1 To $ret[0]
                    MsgBox(0, "Selected", $ret[$i])
                Next
            EndIf
    EndSelect
WEnd
Posted

ok Ill explain basicaly this is your listbox

$listbox = GUICtrlCreateList("", 125, 40, 180, 120, BitOR($LBS_SORT, $WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY, $LBS_MULTIPLESEL))

and then it sets the data

GUICtrlSetData($listbox, "test1|more testing|even more testing|demo|")

then it loops and says that

$msg = GUIGetMsg()

will get the input from the user so it waits for the user to push a button, it uses a

select
case;what to look for
endselect

so when you press it

it mainly just does this

$ret = _GUICtrlListGetSelItemsText ($listbox)
MsgBox(0, "Selected", $ret)

which will show but what everything else does is it checks if its an array or not meaning if there is more then one selected and if there is then it will assign it to an array and this shows them all if it is an array

For $i = 1 To $ret[0]
                    MsgBox(0, "Selected", $ret[$i])
                Next
Posted (edited)

is there a way top modify that script so that each list item has a specific $var?

so when i highlight the list item and press the button in the gui it gives that $var to the script that is stored by that list item/button combo?

Edited by Raluvian
Posted

so just assigning a variable to it?

it already does that in the post above

if you just had one select it would be

the first one that is selected would be, [1] in the array and the second selected would be [2] in the code shows how you would set that up

$ret[1]
$ret[2]
$ret[3]
Posted (edited)

its just if i had a list like

<list>

yeah = $ret[1]

dude = $ret[2]

awesome= $ret[3]

<end>

am i right?

and if so are thies $ret[1]

declairable inside the script?

so if i click yeah then awesome in that order i would get $ret[1] and $ret[3] returned?

Edited by Raluvian

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
  • Recently Browsing   0 members

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