[comp.windows.open-look] Controlling scrolling with views

fgreco@govt.shearson.com (Frank Greco) (02/21/91)

Fellow Openlookers...

I need to create a splittable SCROLLABLE_PANEL where its
views scroll in tandem.  That is, if the user splits
the SCROLLABLE_PANEL vertically (ie, left and right),
I'd like all the views to scroll vertically if *any* of
their (vertical-only) scrollbars are scrolled.

My strategy was to interpose on the scrollbars (set on a
view whenever the user split them), and within my interpose
fn get the SCROLLBAR_VIEW_START for any scrollbar 
and then set this attribute to be the same for all the views.

I can create the SCROLLABLE_PANEL, make them splittable/joinable,
interpose on the scrollbars just fine...but I cannot seem
to be able to get the view's scrollbar in my split_proc().
...I need this to set the interpose fn for the new view.

Since SCROLLABLE_PANELS are OPENWINs, I would think that the 
following would get the view's scrollbar in my split_proc():
[called whenever the user splits a view]

	split_proc(origview, newview,  pos)
	Xv_Window origview, newview;
	int pos;
	{
		Scrollbar sbar;

		sbar = xv_get(newview, OPENWIN_VERTICAL_SCROLLBAR);

		...other stuff...

		notify_interpose_event_func(xv_get(sbar, SCROLLBAR_NOTIFY_CLIENT), doscroll, NOTIFY_SAFE);
	}

But I get a zero for sbar everytime.

Anyone got any ideas why this doesn't work?


Thanks everyone,

Frank G.

dmaustin@vivid.sun.com (Darren Austin) (02/21/91)

In article <lc8vgw9@openlook.Unify.Com> fgreco@govt.shearson.com (Frank Greco) writes:

   Since SCROLLABLE_PANELS are OPENWINs, I would think that the 
   following would get the view's scrollbar in my split_proc():
   [called whenever the user splits a view]

	   split_proc(origview, newview,  pos)
	   Xv_Window origview, newview;
	   int pos;
	   {
		   Scrollbar sbar;

		   sbar = xv_get(newview, OPENWIN_VERTICAL_SCROLLBAR);

		   ...other stuff...

		   notify_interpose_event_func(xv_get(sbar, SCROLLBAR_NOTIFY_CLIENT), doscroll, NOTIFY_SAFE);
	   }

   But I get a zero for sbar everytime.

   Anyone got any ideas why this doesn't work?

Yes.  You should be trying the following to get the view's
scrollbar:

	sbar = (Scrollbar)xv_get(xv_get(newview, XV_OWNER),
			         OPENWIN_VERTICAL_SCROLLBAR, newview);

If you already have a handle to the scrollable panel, then you
can use that instead of the xv_get(newview, XV_OWNER).

Hope this helps,
--Darren
--
Darren Austin                         |  Actually, it's a buck and a quarter
Windows and Graphics Software	      |  staff, but I'm not going to tell
Sun Microsystems, Mountain View       |  *him* that.
dmaustin@sun.com	              |