Using a gnocl::spinButton to Change the Value of a gnocl::entry
A gnocl::spinButton will accept only floating-point values (possibly disguised as integers), and will spin through them only in a fixed numerical sequence. What if you want to spin continuously through a sequence of values that don't fit into that format (such as dates), but you also want to spin through a sequence of values that do fit into that format (such as cheque numbers)?
The answer is simple (once you finally think of it): You use a gnocl::spinButton to change its own value when you press the left mouse button, and to change the value of an adjoining gnocl::entry widget when you press the middle button. This works because the middle button increments the value of the gnocl::spinButton by ten times the left-button increment. When a "10x" increment is recognized, the value of the gnocl::entry is changed, and the value of the gnocl::spinButton reverts to the value retained by way of the -data variable, so it seems to stay the same. When a "1x" (or, at any rate, less than "9x") increment is recognized, the value of the gnocl::spinButton is changed in the normal way, and the value of the -data variable is changed to match that value. This enables the user to spin through a large number of non-floating-point values (such as dates) by continuously pressing the middle mouse button. All you lose is the ability to get actual "10x" increments with the middle button, but the left button gives you such high-speed increments (sometimes up to "5x" or "6x" instead of only "1x," when pressed continuously) that this shouldn't matter much.
Here's what it looks like:
And here's the code: