NeuroToxic Posted December 20, 2007 Share Posted December 20, 2007 Hi all, First, sorry for my bad english, i'm french. I have a problem with a listview and checkbox in this listview. In my listview I have few items. I developed a function that will return the number of items checked in listview. It work very well, but just when an item is selected and checked simultaneously, this item is not count. I also noticed that in AutoIt Help, such "_GUICtrlListViewGetCheckedState" example, the same problem appears. Its a bug or not ? Have you got a solution ? Thank you Link to comment Share on other sites More sharing options...
NeuroToxic Posted December 21, 2007 Author Share Posted December 21, 2007 (edited) Nobody can answer me ? It is a bug of an UDF of AutoIt and in the last version of AutoIt its the same problem Edited December 21, 2007 by NeuroToxic Link to comment Share on other sites More sharing options...
Siao Posted December 21, 2007 Share Posted December 21, 2007 Answers come faster when the question has example code to reproduce the problem. "be smart, drink your wine" Link to comment Share on other sites More sharing options...
NeuroToxic Posted December 21, 2007 Author Share Posted December 21, 2007 this code reproduce the problem : expandcollapse popup#include <GuiListView.au3> Opt('MustDeclareVars', 1) Example_Internal() Func Example_Internal() Local $hListView Local $button_test GUICreate("(Internal) ListView Get Item Checked State", 310, 300) $hListView = GUICtrlCreateListView("", 2, 2, 306, 268) _GUICtrlListView_SetExtendedListViewStyle ($hListView, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES)) GUISetState() ; Add columns _GUICtrlListView_AddColumn ($hListView, "Column 1", 100) _GUICtrlListView_AddColumn ($hListView, "Column 2", 100) _GUICtrlListView_AddColumn ($hListView, "Column 3", 100) ; Add items _GUICtrlListView_AddItem ($hListView, "Row 1: Col 1", 0) _GUICtrlListView_AddSubItem ($hListView, 0, "Row 1: Col 2", 1) _GUICtrlListView_AddSubItem ($hListView, 0, "Row 1: Col 3", 2) _GUICtrlListView_AddItem ($hListView, "Row 2: Col 1", 1) _GUICtrlListView_AddSubItem ($hListView, 1, "Row 2: Col 2", 1) _GUICtrlListView_AddItem ($hListView, "Row 3: Col 1", 2) $button_test = GUICtrlCreateButton("test", 100, 273, 100, 25) ; Loop until user exits While 1 Local $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE GUIDelete() ExitLoop Case $msg = $button_test ;~ check if item 2 is checked MsgBox (4160, "Information", "Item 2 Checked: " & _GUICtrlListView_GetItemChecked ($hListView, 1)) EndSelect WEnd EndFunc ;==>Example_Internal it test if the item 2 is checked or not when I click on the button "Test". The problem appears when I check the item 2 and I select it at the same time. This code is partially the code used in example of AutoIt Help (version : 3.2.10.0) (udf: _GUICtrlListView_GetItemChecked) Link to comment Share on other sites More sharing options...
Siao Posted December 21, 2007 Share Posted December 21, 2007 (edited) That example does not reproduce your problem, it works just fine - if Item2 checkbox is checked, its state is reported as True no matter if the row #2 is selected or not. Tested with 3.2.10.0 Anyway, your problem sounds like a trivial case of not following the AutoIt manual, and doing the GUICtrlRead state flag check by using simple value compare instead of BitAND() like documented. Edited December 21, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
NeuroToxic Posted December 21, 2007 Author Share Posted December 21, 2007 No it's not the problem. Reproduce the following procedure : -- check the item 2 -- select the item 2 -- press the button "Test" The result is False and not True, this is the problem. The problem appears when the item 2 is checked and selected at the same time. Link to comment Share on other sites More sharing options...
GaryFrost Posted December 21, 2007 Share Posted December 21, 2007 No it's not the problem.Reproduce the following procedure :-- check the item 2-- select the item 2-- press the button "Test"The result is False and not True, this is the problem.The problem appears when the item 2 is checked and selected at the same time.Works fine for me in 3.2.10.0 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
NeuroToxic Posted December 21, 2007 Author Share Posted December 21, 2007 Sorry, I completely uninstalled AutoIt and Scite, I reinstalled, and now it works fine. I think it was a bug of an old beta version of AutoIt. thank you for your help Link to comment Share on other sites More sharing options...
Zedna Posted December 22, 2007 Share Posted December 22, 2007 That example does not reproduce your problem, it works just fine - if Item2 checkbox is checked, its state is reported as True no matter if the row #2 is selected or not. Tested with 3.2.10.0 Anyway, your problem sounds like a trivial case of not following the AutoIt manual, and doing the GUICtrlRead state flag check by using simple value compare instead of BitAND() like documented. Only for clarification: Here is related code that Siao was talking about: Func IsChecked($control) Return BitAnd(GUICtrlRead($control),$GUI_CHECKED) = $GUI_CHECKED EndFunc Resources UDF ResourcesEx UDF AutoIt Forum Search 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