Modify

Opened 11 years ago

Closed 11 years ago

Last modified 10 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 follow-up: Changed 11 years ago by Gary

  • Resolution set to Works For Me
  • Status changed from new to closed

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

comment:2 in reply to: ↑ 1 Changed 10 years ago by anonymous

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.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.