[Gambas-user] How do I manage process_Read?
ron
ronstk at ...239...
Sun Sep 12 23:01:07 CEST 2004
On Sunday 12 September 2004 22:10, Ralf Schuchardt wrote:
> On Sun, 12 Sep 2004 15:27:59 -0400
> Rob <sourceforge-raindog2 at ...94...> wrote:
>
> > On Sunday 12 September 2004 14:01, francesco.difusco at ...69...
> > wrote:
> > > I need to execute different Linux command in the same form,
> > > using the EXEC istruction, but I don't know how to manage them
> > > in the same process_read event handler. For every command I
> >
> [...]
> >
> > I agree that it should be possible to have separate _Read events
> > for different Process objects, but I assume there's a reason
> > Benoit did it this way.
>
> You can do this with Object.Attach().
> Suppose there is a form with a button and two textareas:
>
> PUBLIC SUB Button1_Click()
>
> DIM p1 AS Process
> DIM p2 AS Process
>
> EXEC ["ls", "/" ] FOR READ AS p1
> EXEC ["ls", "/usr/lib" ] FOR READ AS p2
>
> Object.Attach(p1, ME, "proc1")
> Object.Attach(p2, ME, "proc2")
>
> END
>
> PUBLIC SUB proc1_Read()
>
> DIM aline AS String
> LINE INPUT #LAST, aline
> aline = aline & "\n"
> TextArea1.Text = TextArea1.Text & aline
>
> END
>
> PUBLIC SUB proc2_Read()
>
> DIM aline AS String
> LINE INPUT #LAST, aline
> aline = aline & "\n"
> TextArea2.Text = TextArea2.Text & aline
>
> END
>
> Ralf
>
This one is really nice to know.
A very clear usage and simple to run out of box.
Thanks for the idea to build on.
Ron
More information about the User
mailing list