FLTK 1.3.2

- Main Page
- Related Pages
- Modules
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Public Attributes | Protected Member Functions
Fl_Value_Input Class Reference

The Fl_Value_Input widget displays a numeric value. More...

`#include <Fl_Value_Input.H>`

Inheritance diagram for Fl_Value_Input:

List of all members.

## Public Member Functions
Fl_Color | cursor_color () const
| Gets the color of the text cursor.
void | cursor_color (Fl_Color n)
| Sets the color of the text cursor.
| Fl_Value_Input (int x, int y, int w, int h, const char *l=0)
| Creates a new Fl_Value_Input widget using the given position, size, and label string.
int | handle (int)
| Handles the specified event.
void | resize (int, int, int, int)
| Changes the size or position of the widget.
int | shortcut () const
| Returns the current shortcut key for the Input.
void | shortcut (int s)
| Sets the shortcut key to `s`.
void | soft (char s)
| See void Fl_Value_Input::soft(char s)
char | soft () const
| If "soft" is turned on, the user is allowed to drag the value outside the range.
Fl_Color | textcolor () const
| Gets the color of the text in the value box.
void | textcolor (Fl_Color n)
| Sets the color of the text in the value box.
Fl_Font | textfont () const
| Gets the typeface of the text in the value box.
void | textfont (Fl_Font s)
| Sets the typeface of the text in the value box.
Fl_Fontsize | textsize () const
| Gets the size of the text in the value box.
void | textsize (Fl_Fontsize s)
| Sets the size of the text in the value box.
## Public Attributes
Fl_Input | input
## Protected Member Functions
void | draw ()
| Draws the widget.

## Detailed Description

The Fl_Value_Input widget displays a numeric value.

The user can click in the text field and edit it - there is in fact a hidden Fl_Input widget with type(FL_FLOAT_INPUT) or type(FL_INT_INPUT) in there - and when they hit return or tab the value updates to what they typed and the callback is done.

If step() is non-zero and integral, then the range of numbers is limited to integers instead of floating point numbers. As well as displaying the value as an integer, typed input is also limited to integer values, even if the hidden Fl_Input widget is of type(FL_FLOAT_INPUT).

If step() is non-zero, the user can also drag the mouse across the object and thus slide the value. The left button moves one step() per pixel, the middle by 10 step(), and the right button by 100 * step(). It is therefore impossible to select text by dragging across it, although clicking can still move the insertion cursor.

If step() is non-zero and integral, then the range of numbers are limited to integers instead of floating point values.

## Constructor & Destructor Documentation

Fl_Value_Input::Fl_Value_Input | ( | int | X,
|  | int | Y,
|  | int | W,
|  | int | H,
|  | const char * | l = `0`
| ) |  |

Creates a new Fl_Value_Input widget using the given position, size, and label string.

The default boxtype is FL_DOWN_BOX.

## Member Function Documentation

Fl_Color Fl_Value_Input::cursor_color | ( |  | ) | const`[inline]`

Gets the color of the text cursor.

The text cursor is black by default.

void Fl_Value_Input::cursor_color | ( | Fl_Color | n | ) | `[inline]`

Sets the color of the text cursor.

The text cursor is black by default.

void Fl_Value_Input::draw | ( |  | ) | `[protected, virtual]`

Draws the widget.

Never call this function directly. FLTK will schedule redrawing whenever needed. If your widget must be redrawn as soon as possible, call redraw() instead.

Override this function to draw your own widgets.

If you ever need to call another widget's draw method from within your own draw() method, e.g. for an embedded scrollbar, you can do it (because draw() is virtual) like this:

            Fl_Widget *s = &scroll;         // scroll is an embedded Fl_Scrollbar
            s->draw();                      // calls Fl_Scrollbar::draw()

Implements Fl_Widget.

int Fl_Value_Input::handle | ( | int | event | ) | `[virtual]`

Handles the specified event.

You normally don't call this method directly, but instead let FLTK do it when the user interacts with the widget.

When implemented in a widget, this function must return 0 if the widget does not use the event or 1 otherwise.

Most of the time, you want to call the inherited handle() method in your overridden method so that you don't short-circuit events that you don't handle. In this last case you should return the callee retval.

Parameters:

  [in] | event | the kind of event received

Return values:

  0 | if the event was not used or understood
  1 | if the event was used and can be deleted

See also:
  Fl_Event

Reimplemented from Fl_Widget.

void Fl_Value_Input::resize | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h
| ) |  | `[virtual]`

Changes the size or position of the widget.

This is a virtual function so that the widget may implement its own handling of resizing. The default version does not call the redraw() method, but instead relies on the parent widget to do so because the parent may know a faster way to update the display, such as scrolling from the old position.

Some window managers under X11 call resize() a lot more often than needed. Please verify that the position or size of a widget did actually change before doing any extensive calculations.

position(X, Y) is a shortcut for resize(X, Y, w(), h()), and size(W, H) is a shortcut for resize(x(), y(), W, H).

Parameters:

  [in] | x,y | new position relative to the parent window
  [in] | w,h | new size

See also:
  position(int,int), size(int,int)

Reimplemented from Fl_Widget.

int Fl_Value_Input::shortcut | ( |  | ) | const`[inline]`

Returns the current shortcut key for the Input.

See also:
  Fl_Value_Input::shortcut(int)

void Fl_Value_Input::shortcut | ( | int | s | ) | `[inline]`

Sets the shortcut key to `s`.

Setting this overrides the use of '&' in the label(). The value is a bitwise OR of a key and a set of shift flags, for example FL_ALT | 'a' , FL_ALT | (FL_F + 10), or just 'a'. A value of 0 disables the shortcut.

The key can be any value returned by Fl::event_key(), but will usually be an ASCII letter. Use a lower-case letter unless you require the shift key to be held down.

The shift flags can be any set of values accepted by Fl::event_state(). If the bit is on that shift key must be pushed. Meta, Alt, Ctrl, and Shift must be off if they are not in the shift flags (zero for the other bits indicates a "don't care" setting).

char Fl_Value_Input::soft | ( |  | ) | const`[inline]`

If "soft" is turned on, the user is allowed to drag the value outside the range.

If they drag the value to one of the ends, let go, then grab again and continue to drag, they can get to any value. The default is true.

Fl_Color Fl_Value_Input::textcolor | ( |  | ) | const`[inline]`

Gets the color of the text in the value box.

void Fl_Value_Input::textcolor | ( | Fl_Color | n | ) | `[inline]`

Sets the color of the text in the value box.

Fl_Font Fl_Value_Input::textfont | ( |  | ) | const`[inline]`

Gets the typeface of the text in the value box.

void Fl_Value_Input::textfont | ( | Fl_Font | s | ) | `[inline]`

Sets the typeface of the text in the value box.

Fl_Fontsize Fl_Value_Input::textsize | ( |  | ) | const`[inline]`

Gets the size of the text in the value box.

void Fl_Value_Input::textsize | ( | Fl_Fontsize | s | ) | `[inline]`

Sets the size of the text in the value box.

The documentation for this class was generated from the following files:

- Fl_Value_Input.H
- Fl_Value_Input.cxx