The script below creates a Treeview and should be a Task Manager showing open and closed tasks. At least when I'm through with programming.
I'm reading the tasks from a SQLite DB and then write each task in a Leaf of a treeview.
This works. But now I want to write the details of a task into a text field when I select the leaf of this task.
So by selecting a leaf with the mouse I want the script to know which leaf has been selected and that it just has been selected.
As far as I understood I should do something like:
found, t = moai.DoMethod("tv", "GetEntry", Active, Active)
If found Then DebugPrint("Active") ; that line is just for testing
It just doesn't work. I have no idea where to place this method and if this is the correct way to do it.
Here my code snippets
Code: Select all
/****************************************************************
** **
** Name: Formular Taskmanager **
** Author: Yvan Gutknecht **
** Version: 1.0 **
** Date: 15.04.22 **
** 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"
strDatabase = "C:/Users/yvang/Documents/relec/Programmierung/Hollywood/TaskManager/database/TaskManager.db"
TaskManagerDB=sqlite3.open(strDatabase)
sqlite3.open(strDatabase )
/*
** 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/TaskManager2.xml"
/*
** Handles all incoming events
*/
Function p_EventFunc(msg)
...
EndFunction
; dynamically create GUI from an external *.xml file definition
moai.CreateApp(ReadString(1))
i = 0;
; listen to these events!
InstallEventHandler({RapaGUI = p_EventFunc})
moai.DoMethod("tv", "open", "root", True)
;open Tasks
i =0
For a1,a2,a3,a4,a5,a6 In TaskManagerDB:urows("SELECT WAL_Wahl_Zahl,PEN_Titel,PEN_Datum ,PEN_Zeit,(SELECT WAL_Wahl_Text FROM TBL_Wahl WHERE WAL_Kategorie = WAL_ID), PEN_Erledigt FROM TBL_Wahl W JOIN TBL_Pendenz P on P.WAL_Prioritaet = W.WAL_ID WHERE PEN_Erledigt=0")
moai.DoMethod("tv", "insertleaf", i, "open", "taskopen", a1, a2, a3, a4, a5)
i = i +1
Next
;Closed Tasks
For a1,a2,a3,a4,a5,a6 In TaskManagerDB:urows("SELECT WAL_Wahl_Zahl,PEN_Titel,PEN_Datum ,PEN_Zeit,(SELECT WAL_Wahl_Text FROM TBL_Wahl WHERE WAL_Kategorie = WAL_ID), PEN_Erledigt FROM TBL_Wahl W JOIN TBL_Pendenz P on P.WAL_Prioritaet = W.WAL_ID WHERE PEN_Erledigt<>0")
moai.DoMethod("tv", "insertleaf", i, "closed", "taskclosed", a1, a2, a3, a4, a5)
i = i +1
Next
; main loop!
Repeat
WaitEvent
Forever