Page 1 of 1

Small Listview bug on Windows

Posted: Sun Nov 07, 2021 11:16 pm
by mrupp
Hi there

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
When setting the active item by code and setting the listview to have the focus (to be "activeObject"), pressing the 'down' key should select the next item below the active item.
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:

Image
Image Image

Cheers,
Michael

Re: Small Listview bug on Windows

Posted: Sat Nov 13, 2021 4:21 pm
by airsoftsoftwair
It's a wxWidgets bug. I've reported it to them, let's see if anybody cares. Otherwise ask again in a few months and I might try to fix it for them ;)