[Gambas-user] How do I manage process_Read?

ron ronstk at ...239...
Wed Sep 15 15:56:26 CEST 2004


On Wednesday 15 September 2004 14:25, Benoit Minisini wrote:
> On Sunday 12 September 2004 21:27, Rob 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
> >
> > Try something like this.....
> >
> > PUBLIC Process1 AS Process
> > PUBLIC Process2 AS Process
> > ...
> > EXEC ["first thing"] FOR READ WRITE AS Process1
> > EXEC ["second thing"] FOR READ WRITE AS Process2
> > ...
> > PUBLIC SUB Process_Read()
> >
> >  if last.id = Process1.id then
> >   ' do something
> >  else if last.id = Process2.id then
> >   ' do somethine else
> >  endif
> >
> > END
> >
> > 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.
> 
> Yes, but not a real good reason. Just that I didn't find a clean syntax for 
> naming the process object in EXEC. AS is already used for filling the process 
> variable.
> 
> I am opened for any suggestion!
> 

I know i'm stupid :)
Making a control invisible at runtime, visible at design time.
Controls have events , so that is the same, and by adding i code
or direct onto the form you have unique Process handle like 
Process1 and process2
Just like the Timer object in example.

dim proc1 as process
  proc1 = NEW Process() AS "proc1"
  proc1.options = array['-la','-v','/home/benoit]  ' :=)
  proc1.output = "/tmp/proc1result" ' for the > redirect
  proc1.input  = "stdin" 'for the < redirect just in case need.
  Proc1.exec = "ls -la"
  proc1.Run

public sub proc1_kill()
  print proc1.id
  if proc1.kill then
    ...
  else
    ...
  endif
end

After all you vcan say Process is a (control) object, doing something.





More information about the User mailing list