#include <csiline.h>
Inheritance diagram for csInputLine:

Public Methods | |
| csInputLine (csComponent *iParent, int iMaxLen=CSIL_DEFAULTLENGTH, csInputLineFrameStyle iFrameStyle=csifsThickRect) | |
| Create input line object. | |
| virtual void | SetText (const char *iText) |
| Set text field. | |
| virtual void | Draw () |
| Draw the input line. | |
| virtual bool | HandleEvent (iEvent &Event) |
| Handle external events. | |
| virtual void | SetState (int mask, bool enable) |
| Override SetState method to redraw input line when it is switched. | |
| void | SetSelection (int iStart, int iEnd) |
| Select text from character iStart to character iEnd. | |
| void | SetCursorPos (int NewPos, bool ExtendSel) |
| Set new cursor position and extend selection if extendsel == true. | |
| virtual void | SuggestSize (int &w, int &h) |
| Report the minimal size of inputline. | |
| virtual bool | IsValidPos (int NewPos) |
| Check whenever new cursor position is valid. | |
| virtual bool | IsValidChar (char iChar) |
| Check whenever a character is valid for inserting into string. | |
| virtual bool | IsValidString (const char *iText) |
| Check if string after modification is valid. | |
| void | DeleteSelection () |
| Delete selection. | |
Protected Methods | |
| int | GetCharX (int iNum) |
| Query character X position within component. | |
| void | SetTextExt (const char *iText) |
| Set text, drop the selection and don't move the cursor. | |
The class has a method called IsValidChar() which can be overriden to implement specific needs, for example if you would like to implement a input line which accepts only numbers you can just override the method IsValidChar() and analyze entered characters. There is also a more general method called IsValidString() which checks the just-modified string for correctness. If method decides that string is incorrect, the changes are undone.