[comp.windows.open-look] Help needed with XView TTY windows

871579l@aucs.AcadiaU.ca (Todd Lowe) (03/20/91)

I'm working on a project under XView 2.0, and one of the 
things is a tty window that output from external programs
goes into.  I have a few questions, but don't have any manuals
only the distribution examples. (manuals are on order ...)

I create a tty:

   frame=(Frame)xv_create(NULL,FRAME,
					FRAME_LABEL, "Output",
					XV_WIDTH,  640,
					XV_HEIGHT, 125,
					FRAME_SHOW_FOOTER, TRUE,
					NULL);


   tty = (Tty)xv_create(frame, TTY, 
				    TTY_ARGV, my_argv,
				    NULL);

where frame is the parent frame, and my_argv[]={"echo","tty",NULL"} 

Later I send various commands through the tty by using:
 
  xv_set(tty, TTY_ARGV, my_argv2, NULL);

where my_argv2 is the new command.

This all works fine, but I'd like to be able to know when the command
is finished so I can change a message in the frame's footer.

I'm currently trying to use wait() as I would with exec, but this 
only seems to work once. After that any commands for the tty are
ignored.

ie: xv_set(tty ...) works
    wait()          wait's till it's done
    xv_set(tty ...) doesn't do a thing.

I have tried using signal() after the wait, but that doesn't seem
to do anything at all, and I don't think it should be there 
anyway.

The other thing I'd like is to have a 	scroll bars on the tty
so anything longer than the window can be reviewed/seen.


Any help on these questions would be appreciated, but please
remember I have no docs to reference, especially the O'Rielly
books .	

-Todd       

jarober@aplcen.apl.jhu.edu (DE Robertson james an 740-9172) (03/20/91)

871579l@aucs.AcadiaU.ca (Todd Lowe) writes:


>I'm working on a project under XView 2.0, and one of the 
>things is a tty window that output from external programs
>goes into.  I have a few questions, but don't have any manuals
>only the distribution examples. (manuals are on order ...)

>This all works fine, but I'd like to be able to know when the command
>is finished so I can change a message in the frame's footer.

>I'm currently trying to use wait() as I would with exec, but this 
>only seems to work once. After that any commands for the tty are
>ignored.

>ie: xv_set(tty ...) works
>    wait()          wait's till it's done
>    xv_set(tty ...) doesn't do a thing.

>I have tried using signal() after the wait, but that doesn't seem
>to do anything at all, and I don't think it should be there 
>anyway.

>The other thing I'd like is to have a 	scroll bars on the tty
>so anything longer than the window can be reviewed/seen.


>Any help on these questions would be appreciated, but please
>remember I have no docs to reference, especially the O'Rielly
>books .	

>-Todd       

	Well, you are really going to need the books. Your problem is that 
calls like wait(), sleep(), signal() must be AVOIDED while using the Notifier -
the Notifier is the beast that does event dispatching for you. Instead, Sun
provides you with a bunch of their own wrappers for these calls. The problem
with that is, it's not that well documented in the manuals. 
	Worse, they claim that using some signals (SIGIO, for one) are 
'advanced' topics, and don't give you any help at all with them. This has
caused me no small amount of grief. My advice to to you is to beg, borrow
or steal for the O'Reilly manual (volume 7, as I recall) - and make sure
that you get the revised copy for OpenLook 2.0. 

Regards,

Jim