Isaac,

Thanks so much - that control is exactly what I need.  I had started
to hack a Composite widget together by wrapping ScrollPanel, and it
was kind of working,
but for some reason Opera wouldn't display the horizontal scrollbar.
And in any case, SliderBar looks 1000 percent better than the standard
ScrollPanel scrollbars.

To possibly save time for others happening upon this message, I would
point out that the SliderBar is unusable
without the accompanying CSS.  In other words, if you just use it out
of the box, it will look like a big mess
on your page.  The class Gen2CssInjector, however, is provided as part
of GWT-Incubator, and it contains a static method called
Gen2CssInjector.addSliderBarDefault() that injects all of the default
CSS for the SlideBar.  That method is not yet documented in the
Javadoc for GWT-Incubator that is posted online, but source code can
nonetheless be found in the GWT-Incubator JAR file.  This assumes, of
course,
that you do not want to write your own CSS for the SliderBar, and most
people will not want to do that up front just to get the
slider to work.

Here is some sample code that sets up a basic SliderBar:

                //Inject the default SliderBar CSS files.
                Gen2CssInjector.addSliderBarDefault();

                //Create the SliderBar with a range between 0 and 100
                sliderBar = new SliderBar(0.0, 100.0);

                //Set the width and height
                sliderBar.setWidth("800px");
                sliderBar.setHeight("200px");

                //Set the smallest increment by which the bar will
advance.
                sliderBar.setStepSize(1.0);

                //Set the initial value
                sliderBar.setCurrentValue(0.0);

                //Set the number of tick marks from the beginning to
the end of the bar
                sliderBar.setNumTicks(100);

                //Set the number of tick mark labels (in this case,
there will be 20 at intervals of 5)
                sliderBar.setNumLabels(5);

                //Handle events
                regexResultsSliderBar.addValueChangeHandler(new
ValueChangeHandler<Double>() {
                        @Override
                        public void onValueChange(ValueChangeEvent<Double> 
event) {
                                double currentSliderBarValue = 
sliderBar.getCurrentValue();
                                valueDisplayTextBox.setText(String.valueOf
(currentSliderBarValue));
                        }
                });


Carl

On Jul 24, 7:02 am, Isaac Truett <[email protected]> wrote:
> Hi Carl,
>
> Sounds like you might want to look at theSliderBarin the GWT
> Incubator project:
>
> http://code.google.com/p/google-web-toolkit-incubator/wiki/SliderBar
>
> I imagine you could style it to look like a browser's scroll bar if
> that's what you want.
>
> - Isaac
>
>
>
> On Fri, Jul 24, 2009 at 2:24 AM, Carl<[email protected]> wrote:
>
> > Does anyone know where a standalone GWT Scrollbar widget might be
> > found?  I'm talking about a scrollbar control that is not attached to
> > a window, that has a settable range of possible integer values through
> > which it scrolls, and to which listeners can be attached to observe
> > changes that the user creates in the presently selected integer within
> > the given range, and for which that same selected integer is also
> > settable from code.
>
> > It seems surprising to me that such a widget does not already exist
> > somewhere, and I'd hate to have to reinvent it, but I can't find one
> > anywhere.
>
> > Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to