Modify

Opened 17 years ago

Closed 17 years ago

Last modified 16 years ago

#606 closed Bug (Works For Me)

Return value error in _GUICtrlListView_GetSelectedIndices

Reported by: jlundqui Owned by:
Milestone: Component: AutoIt
Version: 3.2.12.0 Severity: None
Keywords: listview, index, selected Cc:

Description

When the index of the selected listview item is 0, the string version of the return value is empty and the array version of the return value is single-element array with the first element indicating 0 indices selected.

Attachments (0)

Change History (2)

comment:1 by Gary, 17 years ago

Resolution: Works For Me
Status: newclosed

This works for me:

#AutoIt3Wrapper_au3check_parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <GuiConstantsEx.au3>
#include <GuiListView.au3>

Opt('MustDeclareVars', 1)

$Debug_LV = False ; Check ClassName being passed to ListView functions, set to True and use a handle to another control to see it work

_Main()

Func _Main()
	Local $hListView, $aIndices
	
	GUICreate("ListView Get Selected Indices", 400, 300)
	$hListView = GUICtrlCreateListView("", 2, 2, 394, 268, BitOR($LVS_SHOWSELALWAYS, $LVS_REPORT))
	GUISetState()

	; Add columns
	_GUICtrlListView_AddColumn($hListView, "Column 1", 100)

	; Add items
	_GUICtrlListView_AddItem($hListView, "Item 1")
	_GUICtrlListView_AddItem($hListView, "Item 2")
	_GUICtrlListView_AddItem($hListView, "Item 3")

	; Select multiple items
;~ 	_GUICtrlListView_SetItemSelected($hListView, 1)
;~ 	_GUICtrlListView_SetItemSelected($hListView, 2)
	_GUICtrlListView_SetItemSelected($hListView, 0)
	$aIndices = _GUICtrlListView_GetSelectedIndices($hListView, True)
	For $x = 1 To $aIndices[0]
		MsgBox(4160, "Information", "Selected Indices: " & $aIndices[$x])
	Next

	MsgBox(4160, "Information", "Selected Indices: " & _GUICtrlListView_GetSelectedIndices($hListView))

	; Loop until user exits
	Do
	Until GUIGetMsg() = $GUI_EVENT_CLOSE
	GUIDelete()
EndFunc   ;==>_Main

in reply to:  1 comment:2 by anonymous, 16 years ago

I had the same BUg as jlundqui , it only appears when it should return one value not an array like this: _GUICtrlListView_GetSelectedIndices($hWnd) The Return value is defined as a String and cannot be used as a Number before formatting.

Modify Ticket

Action
as closed The ticket will remain with no owner.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.