Thank you for the update @Melba23.
The -1 in the _SelectItem function is really helpful.
Now to your challenge ("Try to break it!")... 😉
Top 1: _GUIListViewEx_GetLastSelItem()
This function is totally ignorant regarding your latest changes.
You can verify this by running my new example below, press the move button several times and have a look at the status line at the bottom.
If you click into the cell directly then the function _GetLastSelItem() delivers the right result.
Top 2: Still getting multiple selections in some cases
This is a strange one and I think it has something to do with my "Reload" scenario.
Please try to reproduce it by...
Run my example (cell A1 is selected).
Click into the C3 cell and then press the Reload button.
Sometimes it happens at the first time, sometime I have to click C3+Reload several times
The problem is that at one point in time I end up having A1 and C3 selected.
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include "GUIListViewEx_Mod.au3"
; Create GUI
Local $hGUI = GUICreate("My Example", 340, 190)
; Create LV
Local $sLV = "A|B|C"
Local $cLV = _GUICtrlListView_Create($hGUI, $sLV, 8, 8, 320, 100, BitOR($LVS_REPORT, $LVS_SINGLESEL))
_GUICtrlListView_SetExtendedListViewStyle($cLV, $LVS_EX_FULLROWSELECT)
_GUICtrlListView_SetColumnWidth($cLV, 0, 100)
_GUICtrlListView_SetColumnWidth($cLV, 1, 100)
_GUICtrlListView_SetColumnWidth($cLV, 2, 100)
; Create Buttons
Local $idButMove = GUICtrlCreateButton("Move", 30, 115, 80, 40)
Local $idButClear = GUICtrlCreateButton("Clear", 120, 115, 80, 40)
Local $idButReload = GUICtrlCreateButton("Reload", 210, 115, 80, 40)
Local $idLabel = GUICtrlCreateLabel("Selection: ", 8, 165, 180, 20)
; Fill LV
Local $aLV[3][3] = [["A1","B1","C1"],["A2","B2","C2"],["A3","B3","C3"]]
_GUICtrlListView_AddArray($cLV, $aLV)
_GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 64+128+256+512+1024)
; + 64 - No external drag
; + 128 - No external drop
; + 256 - No delete on external drag/drop
; + 512 - No internal drag/drop
; + 1024 - Single cell highlight (forces single row selection)
_GUIListViewEx_MsgRegister() ; Register GUIListViewEx
GUISetState(@SW_SHOW, $hGUI)
; Select first cell
Local $iRow=0, $iCol=0
_GUIListViewEx_SelectItem($iRow, $iCol)
;=== Gui loop
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
ExitLoop
Case $idButMove ; select next cell
$iCol = Mod($iCol+1,3)
If $iCol=0 Then $iRow = Mod($iRow+1,3)
_GUIListViewEx_SelectItem($iRow, $iCol) ; Select cell
Case $idButClear
_GUIListViewEx_SelectItem(-1) ; Unselect all cells
$iRow = 0
$iCol = 0
Case $idButReload ; reload LV
_GUICtrlListView_DeleteAllItems($cLV)
_GUIListViewEx_Close()
_GUICtrlListView_AddArray($cLV, $aLV)
_GUIListViewEx_Init($cLV, $aLV, 0, 0, False, 64+128+256+512+1024)
$iRow = 0
$iCol = 0
_GUIListViewEx_SelectItem($iRow, $iCol) ; Select first cell
EndSwitch ; GUIGetMsg
GUICtrlSetData($idLabel, "Selected: " & _GUIListViewEx_GetLastSelItem())
; ==> Delimited string ListViewIndex|Row|Col
;$vRet = _GUIListViewEx_EventMonitor()
WEnd ; Gui loop
GUIDelete($hGUI)
Exit