[comp.sys.sun] SunView question: positioning parts of a slider

chuck@trantor.harris-atd.com (Chuck Musciano) (02/15/89)

> A slider item consists of 4 parts: the bar itself, the label, the value,
> and the range (the min and max values).  Can someone tell me if it's
> possible to position these four parts individually?

Unfortunately, you are stuck with the layout determined by the SunView
implementers.  There are many shortcomings with sliders, including an
inability to represent real numbers, and (I think) incorrectly setting the
slider position when dealing with a small range of values.  I think you
are forced to do all the custom positioning yourself.

Incidentally, it is not hard to implement a slider yourself with a few
message items containing the values and a pixrect that understands click
and drag events.

Chuck Musciano
Advanced Technology Department
Harris Corporation
(407) 727-6131
ARPA: chuck@trantor.harris-atd.com

mbp@lakisis.umd.edu (Mark Phillips) (02/15/89)

Thanks for the slider info.  As it turns out, I solved the problem some
time ago (the delay with submissions to Sun-Spots is really long!)  by
setting PANEL_SHOW_VALUE to FALSE and using a separate message item, which
gets updated with every call to the slider's notify proc, to display the
slider's value.  I set PANEL_NOTIFY_LEVEL to PANEL_ALL so the value gets
updated whenever the slider is moved.

This actually works very nicely, and I'm using it to implement a slider
which essentially is real-valued.  Of course, internally, the slider's
value is really an integer, but I can display it in whatever format I
want, which in my case is 1/10 of the value.  So my slider takes values
between 1.0 and 2.0.

>       Incidentally, it is not hard to implement a slider yourself
>  with a few message items containing the values and a pixrect that
>  understands click and drag events.

Wouldn't it be nice if you could define new items like this, and
attributes for them (like a typedef), and then create and manipulate them
with panel_create_item, panel_set, etc, just like all the "built-in" item?
But then again, wouldn't a lot of things be nice...!!

	--Mark

[[ The Sun-Spots delay varies.  Notice that this particular message took 5
days including a weekend.  I'm trying to keep it as small as possible (but
things tend to conspire against me).  --wnl ]]