[Gambas-user] Control GUI (Qt5) Gambas program via Standard Input
Bruce Steers
bsteers4 at gmail.com
Tue Feb 14 02:59:27 CET 2023
I just quickly made this simple terminal application i call 1Space.gambas
....
it converts text to only have one space between words.
------------------------------------------
' Gambas module file
Private bReading As Boolean
Public Sub Application_Read()
Dim sTxt As String
bReading = True
While Lof(Last)
sTxt = Last.ReadLine()
Print Split(sTxt, " ", Null, True).Join(" ")
Wend
bReading = False
End
Public Sub Main()
If Args.Max Then
For c As Integer = 1 To Args.Max
Print Split(Args[c], " ", Null, True).Join(" ")
Next
Else
Wait 0.1 ' give the pipe a chance to set bReading if there is a pipe.
While bReading
Wait 0.1
Wend
Endif
File.In.Close
End
---------------------------------
I can use...
1Space.gambas "Test tooo many spaces"
and also
echo "Test tooo many spaces" | 1Space.gambas
Cool , I did not know how to do that till i read this thread :)
Cheers
Respects
BruceS
On Tue, 14 Feb 2023 at 01:00, Bruce Steers <bsteers4 at gmail.com> wrote:
> it's the input handlere.
>
> Putting this in Form_close() fixes it...
> File.In.Close
>
>
> Public Sub Form_Close()
>
> File.In.Close
>
> End
>
> Respects
> BruceS
>
>
> On Mon, 13 Feb 2023 at 23:08, <james at lixce.com> wrote:
>
>> Lee,
>> I noticed the same effect of the app not stoping when using the STATIC
>> keyword. Guess I need to dig into the interpreter source code and see if I
>> can figure anything out which is unlikely because I'm just not that smart.
>>
>> Brian G,
>> I'm passing data and control codes from one Gambas Gui application to
>> another. For example; I want my Weather program to update the current
>> conditions in the Panel application that is always running, the menu based
>> Launcher app requests the panel launch new programs so that the Panel app
>> is the parent of the newly launched process and the Launcher app can exit
>> cleanly, The Contact app requests the Browser open webpages and the Phone
>> Dialer make calls, the Wordprocessor calls the Dictionary app to define a
>> word, etc. The single threaded nature of Gambas makes small programs that
>> cooperate more responsive than large monolithic programs. I can use Pipes
>> or Watch files or even Signals to do these things but Standard In is the
>> traditional (pre-DBUS ) way of doing it and, IF I can get it working, it is
>> an elegant solution as Standard Input is automatically created by the
>> Kernel in a well-documented location that can be derived from the PID of
>> any running application.
>>
>> Regards,
>> J. Jordan
>>
>>
>>
>>
>>
>> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230214/d8359a26/attachment.htm>
More information about the User
mailing list