The following codes creates a Treeview and inserts for leaves dynamically.
See screenshot under the following URL to seee what it creates (odn't look at the Arrows for now)
https://drive.proton.me/urls/AJ39E0GEK4#779ZhwJGhBYQ
Code: Select all
/****************************************************************
** **
** Name: Formular Taskmanager **
** Author: Yvan Gutknecht **
** Version: 1.0 **
** Date: 28.05.23 **
** Interpreter: Hollywood 9.0 **
** Function: Task Manager **
** **
****************************************************************/
/*
** Make sure we have at least Hollywood 9.0!
*/
@VERSION 9,0
/*
** Enable DPI-awareness so that our GUI looks sharp even on high DPI monitors
*/
@OPTIONS {DPIAware = True}
/*
** This script requires the RapaGUI plugin
*/
@REQUIRE "RapaGUI"
@REQUIRE "sqlite3"
/*
** Information about this app
*/
@APPTITLE "Task Manager"
@APPVERSION "$VER: Weight 1.0 (15.04.22)"
@APPCOPYRIGHT "(C) 2022 Yvan Gutknecht"
@APPAUTHOR "Yvan Gutknecht"
/*
** Our XML GUI definition
*/
@FILE 1, "configfiles/TaskManagerTest.xml"
; dynamically create GUI from an external *.xml file definition
moai.CreateApp(ReadString(1))
InstallEventHandler({RapaGUI = p_EventFunc})
moai.DoMethod("tv", "open", "root", True)
;Open Tasks
moai.DoMethod("tv", "insertleaf", 0 , "open", "taskopen", "Prio1", "Title1", "Date1", "Time1", "Cat1")
moai.DoMethod("tv", "insertleaf", 1 , "open", "taskopen", "Prio2", "Title2", "Date2", "Time2", "Cat2")
;Closed Tasks
moai.DoMethod("tv", "insertleaf", 2 , "closed", "taskclosed", "Prio3", "Title3", "Date3", "Time3", "Cat3")
moai.DoMethod("tv", "insertleaf", 3 , "closed", "taskclosed", "Prio4", "Title4", "Date4", "Time4", "Cat4")
; main loop!
Repeat
WaitEvent
Forever
Code: Select all
<?xml version="1.0" encoding="iso-8859-1"?>
<application id="app">
<window id="win" title="Tasks" height="400">
<vgroup>
<treeview id="tv" height="250" notify="active">
<column title="Priority"/>
<column title="Title"/>
<column title="Due Date"/>
<column title="Due Time"/>
<column title="Category"/>
<node id="tasks" name="My Tasks">
<node id="open" name="Open Tasks">
<leaf id="taskopen">
</leaf>
</node>
<node id="closed" name="Closed Tasks">
<leaf id="taskclosed">
</leaf>
</node>
</node>
</treeview>
</vgroup>
</window>
</application>
Now the problem is as you can see in the screenshot, look at the Arrows, it inserts an empty leaf before 'Prio2, Title2...' and also before 'Prio4, Title4 and so on'.
How can I get rid of the empty leaf?
It's not only a cosmetic problem, but this empty leaf is in some kind equal to the leaf with 'Prio1, Title1...'.
So if in the apllication the Users has the idea to delete the empty leaf he will in fact delete the leaf with 'Prio1, Title1 and so on'. Which is really bad.
How can I get rid of the empty leaf?