Sign in to follow this  
Followers 0
JohnWang

CheckBox Within ListViewItem?

3 posts in this topic

Hi

Im making a tweak program which allows the user to select tweaks via checkboxes and apply them at their will. And i was wondering is there a way to put a checkbox in a ListView as a ListViewItem. So it will look like a list with one checkbox on each line (more organized and user friendly).. i tried just putting it in like this

GUICtrlCreateListViewItem($CheckBoxes[0]= GuiCtrlCreateCheckBox("Registry1",20,20,10,10),$List)

But didnt really work... all it display is the checkbox and the ListOverlapping each other and with the value "False" as the listview item. If anyone can kindly help me out.. all helps are appriciated.. Also it might not be possible to do in autoit, if not ill find another way but i really want this to work, Also if any of you have a better way than Lists please post. It doesnt have to be a list actually i just need a container with scrollbars that can hold all the checkboxes and have it in a organized fashion (Tried Group but dont think it supports scrolls). I just thought list looks nice and neat so yeah.. Thanks in advance.

Share this post


Link to post
Share on other sites



You might want to check into the beta udfs

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

opt('MustDeclareVars', 1)
Dim $listview, $Btn_Set, $Btn_SetAll, $Btn_Exit, $msg, $Status, $ret
GUICreate("ListView Set Check State", 392, 322)

$listview = GUICtrlCreateListView("col1|col2|col3", 40, 30, 310, 149, -1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES, $LVS_EX_REGIONAL))
GUICtrlCreateListViewItem("index 0|data1|more1", $listview)
GUICtrlCreateListViewItem("index 1|data2|more2", $listview)
GUICtrlCreateListViewItem("index 2|data3|more3", $listview)
GUICtrlCreateListViewItem("index 3|data4|more4", $listview)
GUICtrlCreateListViewItem("index 4|data5|more5", $listview)
_GUICtrlListViewSetColumnWidth ($listview, 0, 100)
$Btn_Set = GUICtrlCreateButton("Set Index 2", 150, 200, 90, 25)
$Btn_SetAll = GUICtrlCreateButton("Set All", 150, 230, 90, 25)
$Btn_Exit = GUICtrlCreateButton("Exit", 300, 260, 70, 30)
Local $check = 1
Local $checkall = 1
GUISetState()
While 1
 $msg = GUIGetMsg()
 Select
  Case $msg = $GUI_EVENT_CLOSE Or $msg = $Btn_Exit
   ExitLoop
  Case $msg = $Btn_SetAll
   Local $ret = _GUICtrlListViewSetCheckState($listview, -1, $checkall)
   $checkall = Not $checkall
   If ($ret == $LV_ERR) Then
    MsgBox(0, "Error", "Error setting Check state")
   EndIf
  Case $msg = $Btn_Set
   Local $ret = _GUICtrlListViewSetCheckState($listview, 2, $check)
   $check = Not $check
   If ($ret == $LV_ERR) Then
    MsgBox(0, "Error", "Error setting Check state")
   EndIf
 EndSelect
WEnd
Exit

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

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