fltk::FloatInput Class Reference

Inherits fltk::NumericInput.

Inherited by fltk::IntInput.

List of all members.

Public Types

enum  { FLOAT, INT }

Public Member Functions

 FloatInput (int x, int y, int w, int h, const char *l=0)
double fvalue () const
int ivalue () const
long lvalue () const


Detailed Description

A subclass of NumericInput that only allows the user to type floating point numbers (sign, digits, decimal point, more digits, 'E' or 'e', sign, digits), or hex constants that start with "0x". This is done by overriding the replace() method. Besides editing the text the user can use the up/down arrow keys to change the digits.

You may want a ValueInput widget instead. It has up/down buttons (what is called a "Spinner" in some toolkits).

If you change when() to fltk::WHEN_ENTER_KEY the callback is only done when the user hits the up/down arrow keys or when the user types the Enter key. This may be more useful than the default setting of fltk::WHEN_CHANGED which can make the callback happen when partially-edited numbers are in the field.

The type() can either be either FloatInput::FLOAT or FloatInput::INT. Setting it to INT makes this act like the IntInput subclass.


Member Function Documentation

long FloatInput::lvalue (  )  const

FloatInput::ivalue() const Convert the string to an integer, using int(strtol())

Convert the string to a long using strtol()

References fltk::Input::text().

double FloatInput::fvalue (  )  const

Convert the string to a double using strtod()

References fltk::Input::text().


Wed Jun 17 08:45:39 2009. FLTK ©2007 Bill Spitzak and others.
Permission is granted to reproduce this manual or any portion for any purpose, provided this copyright and permission notice are preserved.