[comp.sys.sun] Sunview question.

jao@megatest.uucp (John Oswalt) (01/25/89)

I have a subwindow in which I display text output from a program, and in
which I echo characters typed by the user.  I do various cooking on these
characters before sending them to the program.

I would like this subwindow to be a TEXTSW, but apparently I cannot
recieve ascii events from a TEXTSW, so I have made it a CANVAS.  I can get
events from the canvas, cook the characters in an internal buffer, and use
pw_char to display the text in the canvas.  The problem with this is that
I have had to write a hell of a lot of code to insert characters, maintain
a cursor, move it around, grow the pixwin as the text in it grows, etc.
All stuff that TEXTSWs do for free.  I would like to support full
selection service stuff in this subwindow, but this is very hard, because
while I can get the pixels for any location in the canvas, I don't know
what characters they represent.  I only know the characters which are in
the current line (my cooking buffer).  It has also proved difficult to
handle long lines of entered text, because wrapping lines causes
headaches.

I am now to the point where I an willing to re-write a lot of code in
order to make this subwindow a TEXTSW like it really should be, but
getting events is still critical.  Is there a way to overlay a TEXTSW with
a CANVAS so sunview will handle the character display in the TEXTSW, but I
can still get events from the canvas?  Or, is there a way to get events
from TEXTSWs?  Is this a sun bug?

John Oswalt (..!sun!megatest!jao)

thompson@ames.arc.nasa.gov (Patrick Thompson) (02/03/89)

jao@megatest.uucp (John Oswalt) writes:
> I would like this subwindow to be a TEXTSW, but apparently I cannot
> recieve ascii events from a TEXTSW,  ...

You CAN receive ascii events in a TEXTSW.  What you have to do is register
an "interposer" function with the Notifier.  This will cause all events
directed towards your TEXTSW to be routed through your interposer function
before going to the Base event handler.

After you create your text subwindow, register your interposer function
using the function "notify_interpose_event_func".

For example:
	notify_interpose_event_func(my_textsw, My_Interposer, NOTIFY_SAFE);

"My_Interposer" might look something like this:

	static void
	My_Interposer(frame, event, arg, type)
	Frame   frame;
	Event *event;
	Notify_arg arg;
	Notify_event_type type;
	{
		.
		.
		.
		if (event_is_ascii(event))                  
		{
			ch = (char) event_id(event);
			.
			. 
			. 
		}
	}


- Pat

Patrick Thompson             UUCP: {amdahl, hplabs, ames}!bnrmtv!thompson
Los Gatos, California        ARPA: bnrmtv!thompson@ames.arpa
			     Work: (415) 940-2597  
"irie"                       Home: (408) 354-9615

per@uunet.uu.net (Per Lindberg) (02/22/89)

Yes, it's possible to make a subframe catch ASCII events and have an
interposed function taking care of the input. HOWEVER, it seems to be
impossible (?) to get the Expose and Open keys (L5 and L7) to work once
you told the subframe (in my case, a canvas) to catch keyboard input with

	WIN_CONSUME_KBD_EVENT, WIN_ASCII_EVENTS,
	WIN_CONSUME_PICK_EVENT, WIN_LEFT_KEYS,

The KEY_LEFT(5) and KEY_LEFT(7) events reach the interposed handler all
right, but when I send them on by calling notify_next_event_proc() at the
end of the interposed function, nothing happens.

Aren't canvases supposed to understand L5 and L7? Perhaps only the base
frame can do that?

prentice@bbn.com (Muriel Prentice) (08/01/89)

If I use

    scrollbar_create(0);

when creating a panel with a scrollbar, all events are handled properly.
But, when I try to set attributes in this call, eg.

    scrollbar_create(SCROLL_MARGIN, 0, 0);

and run my application, the right mouse button events in the page button
area seem to be ignored.  Is this a known problem, or should I be setting
the attributes differently?

Muriel Prentice (prentice@bbn.com)

nancie@hal.css.gov (TetherCat 15-0) (11/29/89)

I am trying to place an image created using iconedit into a frame window
running a GKS application.  I have figured out how to use the icon to
close the window, but I just want to place the image on the screen inside
the window.  

If this cannot be done, does anyone know how to convert an image generated
by iconedit into a simple raster image that can be screendumped to the
screen?

Any help will be greatly appreciated.

Thanx in advance.

nancie
nancie@hal.CSS.GOV

bukovins@uunet.uu.net (Dave Bukovinsky) (12/09/90)

I am working on an application that takes advantage of the SunView
interface, running on sun 3/60 + 3/80's, with SunOs 4.0.3.

My question is the following:

The tty as well as text subwindow types support the user blocking a range
of text with the mouse (using left and middle mouse buttons), and this
becomes the 'primary' selection with regards to the selection server (and
text is highlighted/reversed in the process). This is all done as part of
the subwindow types that the application is running in.

My problem is that my application requires using the 'canvas' subwindow
type, and while I've been able to implement the other selection services,
I was wondering if there is any undocumented feature or trick to select a
range of text inside the canvas window. I would prefer not to have to do
it myself (ie. fetching each character, buffering it, and redisplaying it
in reverse video)..

Has anyone else run into this problem and found a solution before?

  Reference texts used: SunView System Programmers Guide
			SunView Programmers Guide

Dave Bukovinsky
	uucp: uunet!motcid!bukovins

gulik@uunet.uu.net (Gregory Gulik) (12/15/90)

I have a program that forks itself and runs in the background when I start
up Sunview.  The problem is that it doesn't seem to be exiting when I exit
sunview.

is there a way for this program to detect sunview exiting??

Oh, this background program does NOT use sunview, but only needs to know
when it's still there..

Please help!
Gregory A. Gulik
        mcdchg!motcid!gulik  ||  greg@gagme.chi.il.us