Jump to content
Sign in to follow this  

Checkboxes in ListView

Recommended Posts

I made a listview using the checkboxes for exStyle. As most of you know, it makes checkboxes in front of every item in the listview. How do you determine whether it is checked or not? I tried getting the state of the ListViewItem but it just returns the data thats in it (ie "abc|defg|hijkl").

Thanks in advanced, and thank you to all those who've been helping me! I greatly appriciate all your help!

Share this post

Link to post
Share on other sites


please show the code, then it is much easier to help you.

So long,


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post

Link to post
Share on other sites

Well, the full code won't do you much good so here is a snippet with spoofed data:

#include <GuiConstants.au3>
#include <GuiListView.au3>
#include <Array.au3>

$version = "1.0"
Dim $pVarName[2], $pVarValue[2], $pVarShared[2], $listViewItems


GuiCreate("EasyCom " & $version,400,200)
$tab = GUICtrlCreateTab(0,0,399,160)
$tab0 = GUICtrlCreateTabitem("Variables")
$VariableListView = GUICtrlCreateListView("Shared|Variable Name|Value",5,25,390,130,"",$LVS_EX_CHECKBOXES)

While 1
   $msg = GUIGetMsg()
      Case $msg = $GUI_EVENT_CLOSE

Func _CreateListItems()
   If UBound($pVarName) <> UBound($listViewItems) Then
      Dim $listViewItems
      For $i = 0 To UBound($pVarName) - 1
         If $i = 0 Then
            $listViewItems = _ArrayCreate(GUICtrlCreateListViewItem("|" & $pVarName[$i] & "|" & $pVarValue[$i],$VariableListView))
            _ArrayAdd($listViewItems,GUICtrlCreateListViewItem("|" & $pVarName[$i] & "|" & $pVarValue[$i],$VariableListView))

Func _UpdateListItems()
   If UBound($pVarName) <> UBound($listViewItems) Then
   For $i = 0 To UBound($listViewItems) - 1
      ;If GUICtrlGetState($listViewItems[$i]) = $GUI_CHECKED Then

This creates ListViewItems with contents like:


The first column is blank because I'm leaving it for the checkbox.

I need to figure out how to get the state of the checkbox.

The array $pVarShared holds either a 1 or a 0. If its a 1 (the checkbox is checked for that item) then 'Shared' is enabled for that item.

Hope you can understand what I'm wanting to do.


I just tried that, it returned 1 everytime even if it wasn't checked.

EDIT: Just kidding gafrost...I was using it wrong. Thanks for the hekp.

Edited by ending

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...