Floppy Posted August 21, 2009 Share Posted August 21, 2009 Hi, why this script doesn't work? #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> #include <ListviewConstants.au3> $GUI = GUICreate("Test") $check=GUICtrlCreateButton('check',10,10,100,20) $ListView = GUICtrlCreateListView("Column1", 20, 40, 250, 250, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW) Dim $avLVItems[5] For $i = 0 To 4 $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView) Next GUISetState() While 1 $m=guigetmsg() Select Case $m=$GUI_EVENT_CLOSE Exit Case $m=$check For $h=0 To 4 If GUICtrlGetState($avLVItems[$h])=$GUI_CHECKED Then MsgBox(0,'','Checked') Next EndSelect WEnd Link to comment Share on other sites More sharing options...
Manjish Posted August 21, 2009 Share Posted August 21, 2009 (edited) Here.. #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> #include <ListviewConstants.au3> $GUI = GUICreate("Test") $check=GUICtrlCreateButton('check',10,10,100,20) $ListView = GUICtrlCreateListView("Column1", 20, 40, 250, 250, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW) Dim $avLVItems[5] For $i = 0 To 4 $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView) Next GUISetState() While 1 $m=guigetmsg() Select Case $m=$GUI_EVENT_CLOSE Exit Case $m=$check For $h=0 To 4 If _GUICtrlListView_GetItemChecked($listview, $h)=True Then MsgBox(4096,"","checked " & "item "&$h) Next EndSelect WEnd Edited August 21, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Floppy Posted August 26, 2009 Author Share Posted August 26, 2009 Here.. #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #Include <GuiListView.au3> #include <ListviewConstants.au3> $GUI = GUICreate("Test") $check=GUICtrlCreateButton('check',10,10,100,20) $ListView = GUICtrlCreateListView("Column1", 20, 40, 250, 250, -1, $LVS_EX_CHECKBOXES + $WS_EX_OVERLAPPEDWINDOW) Dim $avLVItems[5] For $i = 0 To 4 $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView) Next GUISetState() While 1 $m=guigetmsg() Select Case $m=$GUI_EVENT_CLOSE Exit Case $m=$check For $h=0 To 4 If _GUICtrlListView_GetItemChecked($listview, $h)=True Then MsgBox(4096,"","checked " & "item "&$h) Next EndSelect WEnd Yes, but instead of typing _GUICtrlListView_GetItemChecked($listview, $h), is there a way to type _GUICtrlListView_GetItemChecked($listview, $avLVItems[3])? Link to comment Share on other sites More sharing options...
Floppy Posted August 28, 2009 Author Share Posted August 28, 2009 up Link to comment Share on other sites More sharing options...
Manjish Posted August 28, 2009 Share Posted August 28, 2009 Hi FSoft.. Didn't really understand ur question.. Please can u elaborate? [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Floppy Posted August 28, 2009 Author Share Posted August 28, 2009 Hi FSoft.. Didn't really understand ur question.. Please can u elaborate? You write this For loop... Case $m=$check For $h=0 To 4 If _GUICtrlListView_GetItemChecked($listview, $h)=True Then MsgBox(4096,"","checked " & "item "&$h) Next ...to check if a item is checed or not. _GUICtrlListView_GetItemChecked works only if you give it the index of the item. My question is if there's a way to put the item's variable instead of its index. I hope I made myself clear now. Link to comment Share on other sites More sharing options...
Manjish Posted August 28, 2009 Share Posted August 28, 2009 (edited) I haven't tested this.. You can try it out: if BitAnd($itemname,$gui_checked)=$gui_checked then ;put whatever u want here Edited August 28, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com Link to comment Share on other sites More sharing options...
Floppy Posted September 4, 2009 Author Share Posted September 4, 2009 I haven't tested this.. You can try it out: if BitAnd($itemname,$gui_checked)=$gui_checked then ;put whatever u want here No, it doesn't work. Any other solution? Link to comment Share on other sites More sharing options...
picaxe Posted September 4, 2009 Share Posted September 4, 2009 #include <GuiConstants.au3> #include <EditConstants.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <ListviewConstants.au3> $GUI = GUICreate("Test") $check = GUICtrlCreateButton('check', 10, 10, 100, 20) $ListView = GUICtrlCreateListView("Column1", 20, 40, 250, 250, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_OVERLAPPEDWINDOW)) Dim $avLVItems[5] For $i = 0 To 4 $avLVItems[$i] = GUICtrlCreateListViewItem("Item" & $i, $ListView) Next GUISetState() While 1 $m = GUIGetMsg() Select Case $m = $GUI_EVENT_CLOSE Exit Case $m = $check For $h = 0 To 4 If BitAND(GUICtrlRead($avLVItems[$h], 1), $GUI_CHECKED) Then MsgBox(4096, "", "checked " & "item " & $h & " control-id " & $avLVItems[$h]) Next EndSelect WEnd Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now