If I click on an entry for the first time, I get the correct entry from Listview.GetSelection, but if I then click another entry, GetSelection returns the previously clicked entry and not the entry I currently clicked on!?
If I start to select multiple entries, GetSelection returns the correct entries.
But if I then click on another entry (so all selected entries will be deselected), GetSelection returns the previously selected entries.
I know that GetSelection doesn't return the active entry if multiple entries are selected.
If I browse through the listiview by cursor keys and select/deselect some entries everything is returned correct.
Here is short example:
Code: Select all
@REQUIRE "RapaGUI"
; just some aliases
set = moai.set
get = moai.get
dom = moai.DoMethod
Function p_Active()
t = moai.DoMethod("lv", "GetSelection")
f$ = ""
DebugPrint("ListItems(t) = "..ListItems(t))
DebugPrint("t[0] = "..IIf(ListItems(t) > 0, t[0], -1)..", isSel = "..dom("lv", "Select", t[0], "Ask"))
DebugPrint("active = "..get("lv", "active"))
For Local i=0 To ListItems(t)-1
DebugPrint("t["..i.."] = "..t[i])
f$ = f$..dom("lv", "GetEntry", t[i])
Next
;Textentry
set("strTest", "text", f$)
EndFunction
moai.CreateApp([[
<?xml version="1.0" encoding="iso-8859-1"?>
<application>
<window title="Test program" width="300">
<vgroup>
<listview id="lv" notify="active" multiselect="true" >
<column>
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
</column>
</listview>
<TextEntry id="strTest" />
</vgroup>
</window>
</application>
]])
InstallEventHandler({
RapaGUI = Function(msg) If msg.id = "lv" Then Return(p_Active()) EndFunction
})
Repeat
WaitEvent
Forever