Jump to content

Quik help with multiple selecting


Recommended Posts

Hey, i need an easy and quik help,

I've created a program with a list (GUICtrlCreatelist), but if i click on multiple texts in the list, it will only select one text. is there a way to select more then one thing in a list?

Thanks!!!

-ImMenSe

Link to comment
Share on other sites

Example straight from help file

#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


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Moderators

$LBS_MULTIPLESEL: I don't see that in the Beta Help: GUI Control Styles.. am I missing it somewhere?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

how do you do this with a listview??

$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

I tried.. but no go

$pos = GUIGetCursorInfo()
 If ($pos[4] == $listbox) Then
                $ret = _GUICtrlListViewGetCurSel($listbox)
                For $i = 1 To $ret[0]
                MsgBox(0, "Selected",_GUICtrlListViewGetItemText ($listbox,$ret[$i], 0))
                Next
  EndIf
Edited by WTS
Link to comment
Share on other sites

ListView and ListBox are 2 different things.

$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

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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...