After digging a bit I've tried to use the "redraw" mothod without results...
Here is a test code so you can test a simple real case:
Code: Select all
@REQUIRE "RapaGUI"
Function testFunc()
For i=1 To 100
moai.DoMethod("lv", "insert", "bottom", GetTime(True) .. ": " .. "Hello!")
moai.DoMethod("lv", "jump", "bottom")
moai.DoMethod("lv", "redraw")
Wait(20, #MILLISECONDS)
DebugPrint("Added item " .. i)
Next
EndFunction
Function msgHandler(msg)
Switch msg.action
; Parse RapaGUI events
Case "RapaGUI"
; Filter actions by attributes
Switch msg.attribute
; Check button presses
Case "Pressed"
; Check buttons
Switch msg.id
Case "go"
testFunc()
EndSwitch
EndSwitch
EndSwitch
EndFunction
moai.CreateApp([[<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<menubar id="menu">
<menu title="_File">
<item id="mn_about">_About...</item>
<item/>
<item id="mn_quit">_Quit</item>
</menu>
</menubar>
<window title="TEST LV" id="window" menubar="menu">
<vgroup frame="true" frametitle="Update Test">
<listview id="lv">
<column/>
</listview>
<button id="go">GO</button>
</vgroup>
</window>
</application>
]])
; listen to these events!
InstallEventHandler({
RapaGUI = msgHandler
})
; Welcome message
moai.DoMethod("lv", "insert", "bottom", GetTime(True) .. ": " .. "Hello!")
moai.DoMethod("lv", "jump", "bottom")
; Let's go!
Repeat
WaitEvent
Forever
When you push [GO] the callback function will add several lines to the Listview but they are displayed only at the end of the loop, I've added the "redraw" method to try to force a refresh but without success...
I'd like to use a listview as a log box (like in the official demo), but this behaviour does not allow me to track long loops or long operations.
Should I switch to a textview class?