Hello,
I can't find an alternative for the _GUICtrlListView_MapIndexToID function that doesn't work for me.
Is it even possible to find the index from ID-Control in ListView?
I thank you in advance
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>
Example()
Func Example()
GUICreate("listview items", 320, 450, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetBkColor(0x00E0FFFF) ; will change background color
Local $sLb = GUICtrlCreateLabel("Number Item-Index", 20, 335)
Local $nImp = GUICtrlCreateInput("", 20, 350, 150, 24, 0x2000) ;$ES_NUMBER
Local $idButton = GUICtrlCreateButton("Index -> Control-ID"& @CRLF &"Control-ID -> Index ?", 20, 380, 150, 48, BitOR(0x2000, 0x0100)) ;$BS_MULTILINE
GUICtrlSetFont(-1, 11)
Local $idListview = GUICtrlCreateListView("col 1 |col 2 |col 3 |col 4 |", 10, 10, 300, 300) ;,$LVS_SORTDESCENDING)
Local $nP = 0
For $nN = 0 To 10
GUICtrlCreateListViewItem("item "& $nN &"|col "& $nP+1 &"|col "& $nP+2 &"|col "& $nP+3, $idListview)
$nP += 1
Next
GUISetState(@SW_SHOW)
; Loop until the user exits.
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButton
Local $nNr = Number(GUICtrlRead($nImp))
If $nNr >= 0 And $nNr < 11 Then
Local $nID = _GUICtrlListView_GetItemParam($idListview, $nNr)
Local $nIndex = _GUICtrlListView_MapIndexToID($idListview, $nID)
MsgBox($MB_SYSTEMMODAL, "listview", "Input Index = "& $nNr & @CRLF &"Index To ID-Control -> "& $nID & @CRLF &"ID-Control To Index -> "& $nIndex)
EndIf
EndSwitch
WEnd
EndFunc ;==>Example