Re: Spin buttons and direction



After reading a bit of the source, I've found that
you can find the button pressed if you hook up
the changed signal and compare GTK_SPIN_BUTTON(widget)->click_child
with GTK_ARROW_UP or GTK_ARROW_DOWN. This is
much nicer than having to keep track of the old
values (this was turning out to be nasty for
my situation...).

Jeff "Shippy" Shipman     E-Mail: shippy nmt edu
Computer Science Major    ICQ: 1786493
New Mexico Institute of Mining and Technology
Homepage: http://www.nmt.edu/~shippy

On 11 Jan 2001, Havoc Pennington wrote:

>
> Jeff Shipman <shippy nmt edu> writes:
> > I have a set of three spinbuttons that I use
> > for a date. I've set it up so it takes special
> > care for february and leap years, but I would
> > also like to know whether the up or down arrow
> > has been pressed. This way I know how to modify
> > the value in the spinbutton. How can I do
> > this?
>
> Presumably you can just see whether the new value is larger or smaller
> than the old value?
>
> For dates, you definitely want to use the "input" and "output"
> signals, look at testgtk.c in the GTK source distribution for a nice
> example that lets you choose months January-December. For a long time
> I didn't know about these two signals, they are a very useful feature.
>
> Anyhow, in the "input" signal handler you have a chance to see the old
> and new values together I think.
>
> Havoc
>





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