#include <Fl_Input.H>
Public Member Functions | |
Fl_Input (int, int, int, int, const char *=0) | |
Creates a new Fl_Input widget using the given position, size, and label string. | |
int | handle (int) |
Handles the specified event. | |
Protected Member Functions | |
void | draw () |
Draws the widget. |
It displays a single line of text and lets the user edit it. Normally it is drawn with an inset box and a white background. The text may contain any characters, and will correctly display any UTF text, using ^X notation for unprintable control characters. It assumes the font can draw any characters of the used scripts, which is true for standard fonts under MSWindows and Mac OS X. Characters can be input using the keyboard or the character palette/map. Character composition is done using dead keys and/or a compose key as defined by the operating system.
Mouse button 1 | Moves the cursor to this point. Drag selects characters. Double click selects words. Triple click selects all line. Shift+click extends the selection. When you select text it is automatically copied to the selection buffer. |
Mouse button 2 | Insert the selection buffer at the point clicked. You can also select a region and replace it with the selection buffer by selecting the region with mouse button 2. |
Mouse button 3 | Currently acts like button 1. |
Backspace | Deletes one character to the left, or deletes the selected region. |
Delete | Deletes one character to the right, or deletes the selected region. Combine with Shift for equivalent of ^X (copy+cut). |
Enter | May cause the callback, see when(). |
Windows/Linux | Mac | Function
|
^A | Command-A | Selects all text in the widget.
|
^C | Command-C | Copy the current selection to the clipboard.
|
^I | ^I | Insert a tab.
|
^J | ^J | Insert a Line Feed. (Similar to literal 'Enter' character)
|
^L | ^L | Insert a Form Feed.
|
^M | ^M | Insert a Carriage Return.
|
^V, Shift-Insert | Command-V | Paste the clipboard. (Macs keyboards don't have "Insert" keys, but if they did, Shift-Insert would work)
|
^X, Shift-Delete | Command-X, Shift-Delete | Cut. Copy the selection to the clipboard and delete it. (If there's no selection, Shift-Delete acts like Delete)
|
^Z | Command-Z | Undo. This is a single-level undo mechanism, but all adjacent deletions and insertions are concatenated into a single "undo". Often this will undo a lot more than you expected.
|
Shift-^Z | Shift-Command-Z | Redo. Currently same behavior as ^Z. Reserved for future multilevel undo/redo.
|
Arrow Keys | Arrow Keys | Standard cursor movement. Can be combined with Shift to extend selection.
|
Home | Command-Up, Command-Left | Move to start of line. Can be combined with Shift to extend selection.
|
End | Command-Down, Command-Right | Move to end of line. Can be combined with Shift to extend selection.
|
Ctrl-Home | Command-Up, Command-PgUp, Ctrl-Left | Move to top of document/field. In single line input, moves to start of line. In multiline input, moves to start of top line. Can be combined with Shift to extend selection.
|
Ctrl-End | Command-End, Command-PgDn, Ctrl-Right | Move to bottom of document/field. In single line input, moves to end of line. In multiline input, moves to end of last line. Can be combined with Shift to extend selection.
|
Ctrl-Left | Alt-Left | Word left. Can be combined with Shift to extend selection.
|
Ctrl-Right | Alt-Right | Word right. Can be combined with Shift to extend selection.
|
Ctrl-Backspace | Alt-Backspace | Delete word left.
|
Ctrl-Delete | Alt-Delete | Delete word right.
|
Fl_Input::Fl_Input | ( | int | X, | |
int | Y, | |||
int | W, | |||
int | H, | |||
const char * | l = 0 | |||
) |
Creates a new Fl_Input widget using the given position, size, and label string.
The default boxtype is FL_DOWN_BOX.
void Fl_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.
Reimplemented in Fl_File_Input.
int Fl_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.
[in] | event | the kind of event received |
0 | if the event was not used or understood | |
1 | if the event was used and can be deleted |
Reimplemented from Fl_Widget.
Reimplemented in Fl_File_Input.