class MASKING_DLL_DECLSPEC EditBox

An EditBox is like a label except that the text can be edited.

Inheritance:

EditBox - Label - Widget - Rect


Public Methods

[more]virtual void Setup(int x, int y, int w, int h, int key, int flags, const char* text, int len = -1)
A shortcut for Widget::Setup() and SetText()
[more]virtual void SetText(const char* , int = -1)
Puts text into the edit box.
[more]virtual void Select()
These two select and deselect the entire text as if it was double clicked
[more]virtual void Deselect()
See Select()
[more]virtual void ScrollTo(int offset)
Sets the cursor at the given offset and scrolls the text if necessary
[more]int GetMaxLength()
Returns the maximum number of characters the editbox can hold

Protected Fields

[more]int maxLength
The size of the text buffer and efectively the maximum number of characters the edit box is able to hold
[more]int cursorpos
The position of the text cursor
[more]int offsetpos
How far the edit box has scrolled into the string
[more]int selStart
These variables help handling the selection of text

Protected Methods

[more]virtual void Setup(const char* text, int len)
A helper function for setting the text.
[more]virtual int DrawText(int offset, Bitmap& canvas)
Draws as much of the text as it fits on the canvas from the given offset and returns the index of the last character that was drawn
[more]virtual int FindCursorPos()
Finds the index of the character where the mouse cursor is
[more]virtual void UpdateOffset()
Scrolls the text after a key press if necessary
[more]void Draw(Bitmap &canvas)
Draws the widget onto the canvas
[more]void MsgInitSkin()
Initializes the widget with the default skin bitmap, fonts and colours
[more]bool MsgChar(int c)
These two functions handle keyboard input.
[more]bool MsgUChar(int c)
See MsgChar()
[more]void MsgLPress()
This function handles selecting the text and moving the text cursor with the mouse
[more]void MsgLRelease()
This function handles selecting the text and moving the text cursor with the mouse
[more]void MsgMousemove(const Point &d)
This function handles selecting the text and moving the text cursor with the mouse
[more]void MsgDClick()
Selects the entire text
[more]void MsgGotmouse()
When the edit box gets the mouse it changes the mouse cursor to the text selection cursor
[more]void MsgLostmouse()
See MsgGotMouse()
[more]bool MsgWantfocus()
Returns true


Documentation

An EditBox is like a label except that the text can be edited. It is rendered with a sunken panel background into which the text is printed. If there is too much text to fit into the panel it can be scrolled. EditBox also allows parts of the text to be selected.
oint maxLength
The size of the text buffer and efectively the maximum number of characters the edit box is able to hold

oint cursorpos
The position of the text cursor

oint offsetpos
How far the edit box has scrolled into the string

oint selStart
These variables help handling the selection of text

ovirtual void Setup(const char* text, int len)
A helper function for setting the text. Allocates memory if necessary and copies the text over.

ovirtual int DrawText(int offset, Bitmap& canvas)
Draws as much of the text as it fits on the canvas from the given offset and returns the index of the last character that was drawn

ovirtual int FindCursorPos()
Finds the index of the character where the mouse cursor is

ovirtual void UpdateOffset()
Scrolls the text after a key press if necessary

ovoid Draw(Bitmap &canvas)
Draws the widget onto the canvas

ovoid MsgInitSkin()
Initializes the widget with the default skin bitmap, fonts and colours

obool MsgChar(int c)
These two functions handle keyboard input. MsgChar() handles cursor navigation and text management ( selecting, deleting...) while MsgUChar() handles text input. The cursor may be freely moved with the arrow keys and HOME and END. The text can be selected with the same keys if the SHIFT key is pressed simultaneously. The text can be deleted with both the DELETE and BACKSPACE keys. When ENTER is pressed the EditBox sends a MSG_ACTIVATE message to its parent dialog.

obool MsgUChar(int c)
See MsgChar()

ovoid MsgLPress()
This function handles selecting the text and moving the text cursor with the mouse

ovoid MsgLRelease()
This function handles selecting the text and moving the text cursor with the mouse

ovoid MsgMousemove(const Point &d)
This function handles selecting the text and moving the text cursor with the mouse

ovoid MsgDClick()
Selects the entire text

ovoid MsgGotmouse()
When the edit box gets the mouse it changes the mouse cursor to the text selection cursor

ovoid MsgLostmouse()
See MsgGotMouse()

obool MsgWantfocus()
Returns true

ovirtual void Setup(int x, int y, int w, int h, int key, int flags, const char* text, int len = -1)
A shortcut for Widget::Setup() and SetText()

ovirtual void SetText(const char* , int = -1)
Puts text into the edit box. The second parameter is the maximum number of characters you want the edit box to be able to hold. If you pass -1 (or don't pass anything) the maximum length stays the same as it was before calling this function. Initially the maximum length of the text is set to 256. If you pass 0 the maximum length also stays unchanged but if it hasn't been setup yet it is set to the length of the passed string (or 256 if the string is empty or NULL).

ovirtual void Select()
These two select and deselect the entire text as if it was double clicked

ovirtual void Deselect()
See Select()

ovirtual void ScrollTo(int offset)
Sets the cursor at the given offset and scrolls the text if necessary

oint GetMaxLength()
Returns the maximum number of characters the editbox can hold


This class has no child classes.

Alphabetic index Hierarchy of classes


Back to front page   |   page generated with DOC++