https://learn.microsoft.com/en-us/windo ... -selchange
For a multiple-selection list box, the LBN_SELCHANGE notification code is sent whenever the user presses an arrow key, even if the selection does not change.
In a multi-select listview gadget, holding down the arrow keys on the first and last item causes continuous LBN_SELCHANGE notifications, which seems to be causing the issue.
As you can see by running the code below, the same thing happens when the #PB_ListView_ClickSelect flag is set.
Code: Select all
Procedure WinCallback(hWnd, uMsg, WParam, LParam)
If uMsg = #WM_COMMAND
If (WParam >> 16) & $FFFF = #LBN_SELCHANGE
If LParam = GadgetID(0)
Debug "g0: " + GetGadgetState(0)
ElseIf LParam = GadgetID(1)
Debug "g1: " + GetGadgetState(1)
EndIf
EndIf
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Define i.i
OpenWindow(0, #PB_Ignore, #PB_Ignore, 600, 400, "Test")
SetWindowCallback(@WinCallback(), 0)
ListViewGadget(0, 5, 5, 250, 100)
ListViewGadget(1, 300, 5, 250, 100, #PB_ListView_MultiSelect)
;ListViewGadget(1, 300, 5, 250, 100, #PB_ListView_ClickSelect)
For i = 0 To 10
AddGadgetItem(0, -1, "This is item number " + i)
AddGadgetItem(1, -1, "This is item number " + i)
Next
Repeat : Until WaitWindowEvent(1) = #PB_Event_CloseWindow