Sign in to follow this  
Followers 0
Immensee

Quik help with multiple selecting

9 posts in this topic

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

Share this post


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


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

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


[center]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.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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

Share this post


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

 

Share this post


Link to post
Share on other sites

What!?

I can't find that thing in the help file :D

But thanks for the help ! I'm now trying to transfer this code and code it in my program.

-ImMenSe

Share this post


Link to post
Share on other sites

errr... Gary.. I know they're two different things thats why I'm asking how I can do the example submitted for a listview

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