[Gambas-user] Control GUI (Qt5) Gambas program via Standard Input

Benoit Minisini benoit.minisini at gambas-basic.org
Sat Feb 11 22:35:52 CET 2023

Le 11/02/2023 à 05:21, james at lixce.com a écrit :
> I have been beating my head against this for literally years.
> In my Gambas based desktop I want to pass data to programs via their
> Standard Input, for example when I run the weather program I want to
> pass data to the dock to update the current conditions displayed
> there.   I'm currently writing this data to a temp file and then
> sending a signal intercepted  by gb.Signal to prompt the dock to read
> the file. I have also used gb.inotify to watch for file changes.
> Both of those solutions seem rather inelegant to me especially when
> StdIn is just hanging out doing nothing.
> I was very excited to find the Application_Read event handler in the
> documentation but I have spent days trying to get it to fire without
> any success.
> I know the application is getting the input when I use:
> echo "hello" > /proc/$(pgrep -f std-in-test)/fd/0
> because it is echoed in the IDE console or Teminal but I cannot
> figure out how to intercept and process it.
> Here is the code for std-in-test.gambas FMain
> Public Sub _New() Label1.Text = Application.Id End
> Public Sub Application_Read() Debug "App_Read" End

You must declare 'Application_Read()' as a static function.


Benoît Minisini.

More information about the User mailing list