Le 02/11/2021 à 23:05, Stéphane LOS a écrit :
Le 31/10/2021 à 10:41, Blady via Gnoga-list a écrit :
Le 26 oct. 2021 à 11:50, Stéphane LOS<stephane....@slo-ist.fr> a écrit :
Hello there,
justGage in one of the libraries used by the Node-RED Dashboard :
https://flows.nodered.org/node/node-red-dashboard
https://toorshia.github.io/justgage/
It looks pretty simple and it should not be too difficult to create a Gnoga
plugin but I've looked the other plugins and I miss some guidelines on the low
level mechanisms of Gnoga.
I won't give up any soon but a little help would be nice.
I'm looking also on adding charting library. justGage is my first attempt.
Hello Stéphane,
That's nice plugin outcome ;-)
There isn't any standalone guidelines but when writing Pixi plugin I was
inspired by those written by David.
When creating the PIXI plugin I went through the following steps:
First I wrote the complete specification at once, for instance with sprites:
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi-sprite.ads
The Load_PIXI procedure is used to load the needed stuff for the Javascript
part of the plugin.
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.ads#l53
The chosen type of your plugin object may be:
- Gnoga.Gui.Base.Base_Type
- Gnoga.Gui.Element.Element_Type
- Gnoga.Gui.View.View_Type
It depends on which set of API you want to inherit to write the implementation
part of the plugin.
I chose Gnoga.Gui.Element.Element_Type:
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.ads#l60
but it might be Gnoga.Gui.Base.Base_Type:
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.ads#l64
Then comes the creation procedure of the GUI
object.https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi-sprite.ads#l70
All specific API subroutines which follow are split in properties:
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi-sprite.ads#l70
and methods:
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi-sprite.ads#l264
Let be inspired by your Javascript API:
https://github.com/toorshia/justgage#methods
On the implementation side:
The Load_PIXI procedure is implemented with the plugin script.
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.adb#l46
The Create procedure is somewhat special :
- set the object ID with a new one
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.adb#l68
- set the connection ID to the window ID (seem not needed with next step)
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.adb#l69
- attach the object to message system
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.adb#l70
- initialize the object on Javascript side
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.adb#l72
- fire the message child added to the parent
https://sourceforge.net/p/gnoga/code/ci/dev_1.6/tree/components/pixi/src/gnoga-gui-plugin-pixi.adb#l80
Then implements your API using the ones of Gnoga.
If you want to use the message system, ask me.
HTH, Pascal.
https://blady.pagesperso-orange.fr
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list
Hello Pascal,
Thank you very much for your kind support.
I'll dig into this as time permits.
To take a shortcut, if I take this example :
https://toorshia.github.io/justgage/examples/update-object.html
which code is here :
https://github.com/toorshia/justgage/blob/master/docs/examples/update-object.html
I'm wondering how to call :
g1.refresh(myValue)from the Ada side.
Any hint welcome.
Stéphane LOS
https://www.ada4automation.org/
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list
Hello there,
Answering myself :
declare
Result : String :=
Gnoga.Server.Connection.Execute_Script
(ID => App_Data.Main_Window.Connection_ID,
Script => Escape_Quotes
("MW0_Gauge.refresh('"
& Integer'Image (Integer (Word_To_Int (TestMW0)))
& "');"));
begin
null;
end;
Works !
Stéphane LOS
https://www.ada4automation.org/
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list