Psibernetic Posted October 28, 2008 Posted October 28, 2008 _GUICtrlListView_GetItemChecked is returning odd values for different circumstances, in this example I get a msgbox for array numbers 0-4 when i should only get what I have checked, can someone explain this to me? expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> GUICreate("Monitor", 500, 250) $Management_listview = GUICtrlCreateListView("Name|ID", 0, 75, 300, 88, $GUI_SS_DEFAULT_LISTVIEW, BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT));Management_listview Construction _GUICtrlListView_SetColumnWidth ($Management_listview, 0, 200) _GUICtrlListView_SetColumnWidth ($Management_listview, 1, 95) DIM $psi_ListViewItems[1] _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("zero|0", $Management_listview)) _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("One|1", $Management_listview)) _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("Two|2", $Management_listview)) _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("Three|3", $Management_listview)) $Remove_playlist_button = GUICtrlCreateButton("Remove Playlist", 100, 0) GUISetState(@SW_SHOW) While 1 $sys_msg = GUIGetMsg() Switch $sys_msg Case $Remove_playlist_button $count_index = 0 While $count_index <= UBound($psi_ListViewItems)-1 If _GUICtrlListView_GetItemChecked ($Management_listview, $psi_ListViewItems[$count_index]) = True Then MsgBox(16, "0 Based Index item (TRUE)", $count_index) EndIf $count_index = $count_index + 1 WEnd Case $Gui_event_close Exit EndSwitch WEnd Exit [sup]Psibernetic[/sup]My Creations:X-HideSecuracy
GaryFrost Posted October 28, 2008 Posted October 28, 2008 Can't use the control Id in lue of the index: expandcollapse popup#include <GuiConstants.au3> #include <GuiListView.au3> GUICreate("Monitor", 500, 250) $Management_listview = GUICtrlCreateListView("Name|ID", 0, 75, 300, 88, $GUI_SS_DEFAULT_LISTVIEW, BitOR($LVS_EX_GRIDLINES, $LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT));Management_listview Construction _GUICtrlListView_SetColumnWidth($Management_listview, 0, 200) _GUICtrlListView_SetColumnWidth($Management_listview, 1, 95) Dim $psi_ListViewItems[1] _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("zero|0", $Management_listview)) _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("One|1", $Management_listview)) _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("Two|2", $Management_listview)) _ArrayAdd($psi_ListViewItems, GUICtrlCreateListViewItem("Three|3", $Management_listview)) $Remove_playlist_button = GUICtrlCreateButton("Remove Playlist", 100, 0) GUISetState(@SW_SHOW) While 1 $sys_msg = GUIGetMsg() Switch $sys_msg Case $Remove_playlist_button For $count_index = 0 To UBound($psi_ListViewItems) - 1 ConsoleWrite($psi_ListViewItems[$count_index] & @LF) If _GUICtrlListView_GetItemChecked($Management_listview, $count_index) = True Then MsgBox(16, "0 Based Index item (TRUE)", $count_index) EndIf Next Case $Gui_event_close Exit EndSwitch 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.
Psibernetic Posted October 28, 2008 Author Posted October 28, 2008 Thanks, Can't believe I didn't catch that! Guess sometimes what you really need is another pair of eyes. [sup]Psibernetic[/sup]My Creations:X-HideSecuracy
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