Re: Making Gtk::Button receive spin events (as per Gtk::SpinButton)



Jonathon,

Thanks for your response.  I do have an odd task, and it does require odd approaches.  :)

The application I'm writing requires a thorough validity check on the data entered, to see
if they represent a well-formed 'double' value.  For this reason, I would like to have a widget
that, in its internal organization, behaves identically to Gtk::Entry.  In particular, everything
must stored as a string.  This string will then be checked for validity.  The validation check will
not be triggered by the entry itself but come as an external request only.  If the string content
of the entry is a syntactically valid 'double' value, then it gets accepted, which, in particular,
means that one should be able to use the spinning functionality to modify it.  Otherwise
spinning should become a no-op.

The reason I can't use Gtk::SpinButton is that it is too tied to doing everything in terms of
doubles rather than strings.  As an example, if you type something like "abcdefg" in and then
hit Tab, it automatically converts it to a null.  Similarly, "9 2" gets interpreted as 9.  Granted,
this may be reasonable for office apps, but in my case this may actually cause a disaster.
In order words, it is never OK for the widget to modify the entered content on a whim or use
some default interpretation if this content is not valid, as far as my task is concerned.

Since the pre-defined behavior doesn't suit, I made a hard decision to roll my own version
of the spin entry.  I set it up to be an HBox, with the first child being a Gtk::Entry, and the second
one a VBox containing two Gtk::Button's -- those I intend to use for scrolling.  Hence my original
question.

As far as what I use to generate scroll events, aren't they always mouse-generated?  You click
on the "up" or "down" arrow of a spin box, and hold the mouse pressed to make the entry "spin".
Or I'm missing something fundamental?

Does this remove all misunderstanding gaps?


Regards,

Nickolai




I don't quite understand what you're trying to do here.  What are you
using to generate scroll events?  Is there any reason you can't just
use a Gtk::SpinButton?

Jonner




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