[Gambas-user] How do I manage process_Read?

Ralf Schuchardt rasc at ...17...
Sun Sep 12 22:10:29 CEST 2004


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




More information about the User mailing list