[comp.windows.x] Why is my scrollbar's top always 0.0 or possibly garbage?

mjs@behemoth.genetics.wisc.edu (Mike Schmelzer) (04/02/91)

[ Background: I'm trying to get an Athena scrollbar to work. SunOS
4.1, X11R4. I have O'Reilly 4 & 5, Xt and Xaw docs as my guides. I
have RTFM'ed and am still at a loss.  My jumpProc works okay, but I
can't seem to get the scrollProc to anything useful. About the only
thing I can get the scrollProc to do is cast the call_data parameter
into the correct number of pixels. Before I elaborate on the specific
problem I'm having, maybe I should ask generally: How to you get an
Athena scrollbar to work with Buttons 1 and 3? The xscroll example in
the R4 distrib was unilluminating. Anyway, on to the problem at
hand... ]

Inside my XtNscrollProc callback procedure, named do_scroll(), I try
to get the current value of the scrollbar's thumb:

  float old_top;
  float shown;
  Dimension width;

  n = 0;
  XtSetArg(args[n], XtNtop, &old_top); n++;
  XtSetArg(args[n], XtNwidth, &width); n++;
  XtSetArg(args[n], XtNshown, &shown); n++;
  XtGetValues(scrollbar, args, n);

By this method, I can get correct values for "shown" and "width", but
I'm not sure what's being put into "old_top".  For old_top, I get a
very small value which I assume is a garbage value. Using gdb, I see
that old_top initially has the garbage value 3.02495e-40, and after
XtGetValues(), it has 1.4013e-45, which gets read as zero by the
program.

I then went to my XtNjumpProc callback, do_thumb(), and set up the same
XtGetValues() call. Again, garbage.

Please help me!

--
==== Mike Schmelzer, UW Genetix, mjs@genetics.wisc.edu, (608)263-7459. ===
========= Schmelzer's Law: You can have anything you don't want. =========
================ "How can hatred uplift a race?" - 3rd Bass ==============

mjs@behemoth.genetics.wisc.edu (Mike Schmelzer) (04/03/91)

I solved my problem.

A quick look at the source for the Athena scrollbar widget reveals
that the proper name for the resource I want is XtNtopOfThumb and
*not* XtNtop, which is an Edge type.

The Xaw documentation had it right, but O'Reilly had it wrong.

My scrollbar works "as advertised" now. Yay!

Now all I have to do is get the scrollbar settings to affect another
widget. I'm sure you'll be hearing from me soon :-)

Sorry to trouble you.
--
==== Mike Schmelzer, UW Genetix, mjs@genetics.wisc.edu, (608)263-7459. ===
========= Schmelzer's Law: You can have anything you don't want. =========
================ "How can hatred uplift a race?" - 3rd Bass ==============