I found a small bug with the Listview widget in "listview" mode on Windows. Check out this small example:
Code: Select all
@REQUIRE "RapaGUI", {Link = True}
@APPTITLE "ListView-ActiveItem-Test"
Function p_EventFunc(msg)
DebugPrint(msg.id, msg.Attribute)
If LeftStr(msg.id, 3) = "btn"
Local listviewId$ = "listview" .. MidStr(msg.id, 3, 1)
moai.Set(listviewId$, "active", 2)
moai.Set("mainWindow", "activeObject", listviewId$)
EndIf
If msg.Attribute = "DoubleClick"
Local activeObject = moai.Get("mainWindow", "activeObject")
moai.Set("lblInfo", "text", activeObject)
DebugPrint("activeObject:", activeObject)
EndIf
EndFunction
moai.CreateApp([[<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<window id="mainWindow" title="ListView-ActiveItem-Test">
<vgroup>
<text id="lblInfo">Set item using the button and press 'down' key afterwards.</text>
<hgroup frame="true" frametitle="Listview0 in listbox mode">
<button id="btn0">Set item and focus</button>
<listview id="listview0" height="160" notify="doubleclick" forceMode="listbox">
<column title="Text" />
</listview>
</hgroup>
<hgroup frame="true" frametitle="Listview1 in listview mode">
<button id="btn1">Set item and focus</button>
<listview id="listview1" height="160" notify="doubleclick" forceMode="listview">
<column title="ID" />
<column title="Text" />
</listview>
</hgroup>
<hgroup frame="true" frametitle="Listview2 in dataview mode">
<button id="btn2">Set item and focus</button>
<listview id="listview2" height="160" notify="doubleclick" forceMode="dataview">
<column title="ID" />
<column title="Text" />
</listview>
</hgroup>
</vgroup>
</window>
</application>
]])
InstallEventHandler({RapaGUI = p_EventFunc})
For Local i = 0 To 100
moai.DoMethod("listview0", "insert", "bottom", "Item " .. i)
moai.DoMethod("listview1", "insert", "bottom", i, "Item " .. i)
moai.DoMethod("listview2", "insert", "bottom", i, "Item " .. i)
Next
Repeat
WaitEvent
Forever
This works perfectly well with MUI and on macOS. On Windows, it only works in listbox and dataview mode, but not in listview mode. Instead, the first item is selected. Here are some screenshots, expected behaviour would be to have "item 3" selected in all listviews:
Cheers,
Michael