Updating listviews...
Updating listviews...
I'm a RapaGUI beginner, and I've tried to search the forum for an aswer but nothing found
The problem I have is that I'd like to update a listview where I'm adding log entries during a long operation, the loop runs from a callback, but seems that the listview (with my added entries) is only updated when the callback returns to the main loop that listen to the events.
Any hints about making the listview update as soon as an entry has been added?
The problem I have is that I'd like to update a listview where I'm adding log entries during a long operation, the loop runs from a callback, but seems that the listview (with my added entries) is only updated when the callback returns to the main loop that listen to the events.
Any hints about making the listview update as soon as an entry has been added?
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Updating listviews...
I do have WaitEvent in the main loop and in the loop called from the callback I've tried to add a CheckEvents() but without results.
This is piece of code of the official demo (from line 185):
if you change the For/Do as following you will notice that entries are displayed all togheter when finished:
Hope this help
This is piece of code of the official demo (from line 185):
Code: Select all
Case "lvaddmany":
Local c = moai.Get("listview", "entries")
If android Then moai.Set("listview", "quiet", True)
For Local k = 0 To 999 Do moai.DoMethod("listview", "insert", "bottom", "Row " .. c + k .. " item " .. "1", "Row " .. c + k .. " item " .. "2", "Row " .. c + k .. " item " .. "3")
If android Then moai.Set("listview", "quiet", False)
Code: Select all
For Local k = 0 To 999 Do Wait(10, #MILLISECONDS) moai.DoMethod("listview", "insert", "bottom", "Row " .. c + k .. " item " .. "1", "Row " .. c + k .. " item " .. "2", "Row " .. c + k .. " item " .. "3")
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Updating listviews...
I forgot to say that I'm on Linux
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Updating listviews...
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:
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?
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
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?
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Updating listviews...
Nope... tested textview & texteditor without any joy... I smell I have to put long operations inside timed callbacks like in the official demo for Progress Bars :
but this overcomplicate things...
Andreas, if you're around, give it a shot!
Code: Select all
Case "pbsimprg":
If Not HaveObject(#INTERVAL, 1)
p_Log("Starting progress bar...")
prgbarc = 0
SetInterval(1, p_ProgressbarTimer, 100)
moai.Set("pbsimprg", "text", "Stop timer")
Else
ClearInterval(1)
moai.Set("pbsimprg", "text", "Simulate progress")
EndIf
Andreas, if you're around, give it a shot!
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Updating listviews...
Allanon wrote: ↑Wed Jan 24, 2024 7:02 pm
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?
seems a Linux issue, under windows11 i see your example WITHOUT wait, isntantly show
check video -> https://streamable.com/lqo8vu
Christos
Re: Updating listviews...
Thank you for trying the sample script but the point is in the line you commented outplouf wrote: ↑Wed Jan 24, 2024 8:56 pmAllanon wrote: ↑Wed Jan 24, 2024 7:02 pm
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?
seems a Linux issue, under windows11 i see your example WITHOUT wait, isntantly show
check video -> https://streamable.com/lqo8vu
When you have the Wait() command uncommented do you see the listview populate during the for/next loop, one line at a time, or do you see all the entries at the end?
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
Re: Updating listviews...
Thats the point of comenting out
With commented out wait is the video
I see with or without wait filling
With commented out wait is the video
I see with or without wait filling
Christos
Re: Updating listviews...
I see, so it's seems a Linux related problem...
I've the chance to test it on Windows 10 and yes, seems a bug
thank you for your time
I've the chance to test it on Windows 10 and yes, seems a bug
thank you for your time
----------------------------
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆
[Allanon] Fabio Falcucci | GitHub for recent works | Support me on Patreon for Hollywood libraries | ☆★ All my links ★☆