Jump to content
Sign in to follow this  
CrimsonRiot

Checkboxes in ListView

Recommended Posts

CrimsonRiot

How would i do this? How would i be able to return the items checked (My list size will vary)?

Share this post


Link to post
Share on other sites
Zedna

create listview with style $LVS_REPORT and exstyle $LVS_EX_CHECKBOXES

for example

$ListView1 = GUICtrlCreateListView("Col1|Col2|Col3", 8, 212, 458, 364, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_HSCROLL,$WS_VSCROLL,$WS_BORDER), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES,$LVS_EX_FULLROWSELECT))

for get checked state:

#include <GuiListView.au3>
...
$all = ''
$pocet = _GUICtrlListViewGetItemCount($ListView1)
    For $i = 0 To $pocet - 1
        If _GUICtrlListViewGetCheckedState($ListView1, $i) Then
            $tmp = _GUICtrlListViewGetItemText($ListView1, $i, 1) 
            If $tmp <> '' Then $all &= $tmp  & @LF
        EndIf
    Next

ConsoleWrite($all)
Edited by Zedna

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.