Sign in to follow this  
Followers 0
Der_Andi

How to make a ListView with Checkboxes?

3 posts in this topic

Hi,

I had a script which contained a ListView with Checkboxes. Unfortunately, I deleted it. :)

Now i can't recreate it. I tried the following piece of code and similar things from the forum:

#NoTrayIcon
#include <GuiConstants.au3>
#include <GuiListView.au3>
Opt("GuiOnEventMode", 1)
Opt("GUICloseOnESC", 0)

$gui_main = GUICreate("", 500, 300)
GUISetOnEvent($gui_event_close, "_quit")
GUISetFont(9, 400, 0, "Tahoma")

$list = GUICtrlCreateListView("Col1|Col2", 20, 20, 300, 200)
_GUICtrlListView_SetExtendedListViewStyle(-1, $lvs_ex_checkboxes)

GUISetState()
While 1
    Sleep(1000)
WEnd

Func _quit()
    Exit
EndFunc

The problem is: I get a ListView with two columns Col1 and Col2, but no checkboxes at all...

Could someone tell me, what's wrong here? Any help would be appreciated very much... thanks.

Andi

Share this post


Link to post
Share on other sites



#include<GUIConstantsEx.au3>
#include<GuiListView.au3>
#include<ListViewConstants.au3>
#include<StaticConstants.au3>

GuiCreate('Wallpaper Rotater Configuration', 500, 406) 
    
GuiSetFont(11)
    
GuiCtrlCreateLabel('Your current pictures:', 10, 0, 195, 25, $SS_CENTERIMAGE) 

$lstDirectories = GuiCtrlCreateListView('Name|Directory|Position', 10, 25, 395, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT))
    _GUICtrlListView_SetColumnWidth($lstDirectories, 0, 150)
    _GUICtrlListView_SetColumnWidth($lstDirectories, 1, 245)
    _GUICtrlListView_SetColumnWidth($lstDirectories, 2, 100)
    
_GuiCtrlListView_AddItem($lstDirectories, 'Hello')
    
GuiSetState()

While GuiGetMsg() <> -3 
WEnd


My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

yeah, i just figured it out, as you wrote your answer. :)

i think, my brain isn't working at 100% at the moment... maybe i should go to bed.

Edited by Der_Andi

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