Re: How to enter a floating-point number ?



Gan3sh wrote:
Hi,

I would like to add a widget in my application to be able to enter a
floating-point number and only that.
If I use a GtkEntry, I didn't see in the doc how to restrict the
available characters to only digits (and also . + -).
And if I use a GtkSpinButton, I didn't see how to set the arrows
unvisible.

Is there another widget for entering only a number ?

Hmmm,
    I dont think this should be in the gtk+ domain.
Why not just use a GtkEntry and use string conversion utilities
(i.e. isdigit() or some varient) ?

You can preemptivly deny some charachters input by catching
the GdkEventKey's (i.e. "key-press-event" on the GtkWidget object)
in advance and returning TRUE if you dont want that key to be
processed (i.e. if you dont want the GtkEntry's handler to be called).

Cheers,
                                          -Tristan




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