Sign in to follow this  
Followers 0
dazza

Listview with tickboxes

4 posts in this topic

Looking at the example GUI on the home page, I need the listbox with tickboxes.

e.g. item1 []

item2 []

etc.

Is this a listview? What do I add to get the tickboxes showing?

Many thanks in advance.

Share this post


Link to post
Share on other sites



Try this code:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ListviewConstants.au3>
#Include <GuiListView.au3> ; UDF!!

Dim $msg, $gui, $list, $listitem

$gui = GUICreate("test", 250, 350)
$list = GUICtrlCreateListView("test", 10, 10, 230, 330, -1, $LVS_EX_CHECKBOXES)
$listitem = GUICtrlCreateListViewItem("testitem", $list)

; Next sentence is to set the width of the column automatically to the largest width of all items
_GUICtrlListView_SetColumnWidth($list, 0, $LVSCW_AUTOSIZE) ; This is not AutoIt native! It's a User Defind Function. Someone made it and AutoIt included this for you! You also need the above include.
GUISetState()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then Exit
WEnd

Your specifically looking for this line: $list = GUICtrlCreateListView("test", 10, 10, 230, 330, -1, $LVS_EX_CHECKBOXES)

The last part: $LVS_EX_CHECKBOXES gives the checkboxes to the items.


My active project(s): A-maze-ing generator (generates a maze)

My archived project(s): Pong3 (Multi-pinger)

Share this post


Link to post
Share on other sites

That's perfect

:P

Share this post


Link to post
Share on other sites

Having just beat my head on this one also, it is worth noting for fellow searchers:

In the example line: GUICtrlCreateListView("test", 10, 10, 230, 330, -1, $LVS_EX_CHECKBOXES)

If the "-1" is not there (the style switch), the checkboxes will not display.


Thanks,drwoobieMy Projects:Network Drive Profile Tool

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