Jump to content

Multiple select GUICtrlCreateList


tbaror
 Share

Recommended Posts

Hello All,

i am newbie with Autoit i have started creating gui code with Koda, after generating code to Scite Opt("GUIOnEventMode", 1).

the gui basically should give GUICtrlCreateList with Multiple values selection the problem i don't know how to retrieve the multiple values.

i know its should loop with array but i didn't found exactly how to do it.

please advise

thanks

$Listtestr = GUICtrlCreateList("", 8, 200, 73, 90, BitOR($LBS_SORT,$LBS_MULTIPLESEL,$LBS_STANDARD,$WS_VSCROLL,$WS_BORDER))

GUICtrlSetData($Listtestr, "-i0|-i1|-i10|-i11|-i12|-i2|-i3|-i5|-i6|-i7|-i8|-i9")

GUICtrlSetOnEvent($Listtestr, "ListtestrClick")

$rButton = GUICtrlCreateButton("Select Tests", 8, 302, 66, 22, $BS_FLAT)

GUICtrlSetBkColor($rButton, 0x0000FF)

GUICtrlSetOnEvent($rButton, "rButtonclick")

Func rButtonclick()

$TstR = GUICtrlRead ($Listtestr)

MsgBox(0, "Selected", $TstR)

EndFunc

Link to comment
Share on other sites

Maybe...

#include <File.au3>
#include <GUIConstants.au3>
;#include <GUITreeview.au3>
#include <GuiList.au3>

Opt("GUIOnEventMode", 1)

$Gui = GUICreate("")

GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")

$listbox = GUICtrlCreateList("", 8, 200, 73, 90, BitOR($LBS_SORT, $LBS_MULTIPLESEL, $LBS_STANDARD, $WS_VSCROLL, $WS_BORDER))
GUICtrlSetData($listbox, "-i0|-i1|-i10|-i11|-i12|-i2|-i3|-i5|-i6|-i7|-i8|-i9")
;GUICtrlSetOnEvent($Listtestr, "ListtestrClick")
$rButton = GUICtrlCreateButton("Select Tests", 8, 302, 66, 22, $BS_FLAT)
;GUICtrlSetBkColor($rButton, 0x0000FF)
GUICtrlSetOnEvent($rButton, "rButtonclick")
GUISetState()

While 1
    Sleep(20)
WEnd

Func rButtonclick()
    $ret = _GUICtrlListGetSelItemsText($listbox)
    If $ret = "" then Return
    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
EndFunc   ;==>rButtonclick

Func CLOSEClicked()
    MsgBox(0, "GUI Event", "You clicked CLOSE! Exiting...")
    Exit
EndFunc   ;==>CLOSEClicked

Ex

Edited by Examiner
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...