spinner widget



(Originally posted to gtk-list)

Tristan Van Berkom wrote:
On Mon, 2007-03-26 at 10:51 -0500, James Pelletier wrote:
I've been working on a spinner widget that is basically just the spinner portion of a spinbutton.

Although the spinbutton handles numbers fairly cleanly, it doesn't seem to work well when trying to use it for other purposes. Although you can use the signals to have it display text (like the days of the week example), it does not handle user typing in a value well. Also, since there is no way to change how it looks, it always appears as an entry that the user can type in.

My solution to this is a stand-alone spinner widget. The spinner will just appear as a pair of arrows and hold a double value and the developer could use that value to control a plain label, image, or anything else.

The spinner as I have written it derives from GtkRange and has "wrap" and "snap_to_ticks" properties (the same as the spinbutton).


Hi James,
   This list is for general questions about gtk+, usually that means
support for people trying to compile or use the gtk+ api, might
I suggest you send this mail to gtk-devel-list gnome org, which is
about the development of the gtk+ libraries.

FWIW, I think that what you've done is a really great idea - IMO
widgets should be as simplistic as possible and combinations of
entries/spinners should be done in more high-level "composite
widgets" - great idea... however the fact that we already have
a GtkSpinButton that exists and has a public API that "cannot be broken" may mean that we cant take advantage of such a redesign/refactoring...
One question I'd have to put to you: Do you think its possible
with the code you've written to make the existing GtkSpinButton
use your spinner instead... without breaking the existing
spinbutton api ?

Anyway, try sending this mail to the gtk+ development list - I'm
curious to see what they have to say on the matter ;-)

Cheers,
                -Tristan


Sorry for sending to the wrong list the first time.

I'm not saying that the spin button be removed. Again, there are certain cases where the existing spin button works fine, but I've run into many cases where it doesn't work well and it was easier to have a stand-alone widget.

Since the spinner derives from Range, it doesn't look as natural next to an entry (it's slightly taller), but that may not be such a big deal. I always thought the buttons on the spinbutton were annoyingly small, anyway.

I don't think it would be hard to replace the functionality in a new composite widget, either. As a matter of fact, I've already written a controller in one of my applications that ties the spinner to an entry widget and makes sure that the spinner's value is only updated when what the user may have typed in is valid.

I guess replacing the existing spinbutton could be a goal, but could the first step be to get the spinner added, and then come back to a new composite widget? I can still see a stand-alone spinner as a useful widget.

James



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]