Обзор
Примеры
Скриншоты
Сравнения
Приложения
Загрузить
Руководства
Базар
Статус и История
Частые вопросы (FAQ)
Авторы и лицензия
Форум
Помощь проекту
Поиск по сайту
Язык
русский













SourceForge.net Logo



Эта страница еще не переведена. Вы хотите перевести?

 

EditField

 

class EditField : public Ctrl, private TextArrayOps

 

 

This widget is used whenever there is a type of value that can be edited in its textual representation. Of course, the most evident type of value is (W)String, but EditField can be used to edit any other type like Date, int, double. Adaptation of EditField is achieved by using Convert based object to transform Value to text and back.

 

 

Public Member List

 

static int GetViewHeight(Font font = StdFont())

Returns the correct height for EditField view with font used for edited text.

 


 

static int GetStdHeight(Font font = StdFont())

Returns the correct height for EditField with font used for edited text, including the standard static frame.

 


 

Callback1<Bar&WhenBar

This callback represents the context menu of EditField. The default is StdBar.

 


 

int Insert(int pos, const WString& text)

Inserts text at pos.

 


 

int Insert(int pos, const String& text)

int Insert(int pos, const char *text)

Inserts text at pos. Text is converted to unicode using the default charset.

 


 

void Remove(int pos, int n)

Removes n characters at pos.

 


 

void Insert(const WString& text)

Inserts text at cursor position.

 


 

void Insert(const String& text)

void Insert(const char *text)

Inserts text at cursor position. Text is converted to unicode using the default charset.

 


 

void Insert(int chr)

Inserts a single unicode chr at cursor position.

 


 

void Move(int newpos, bool select = false)

Moves the cursor to newpos. If select is true, selection is set between recent cursor position and newpos.

 


 

void SetSelection(int l = 0, int h = INT_MAX)

Sets the selection if l < h. If l or h exceed the available range (that is zero to length of text), they are bound to it. If l >= h, selection is canceled and l is the new cursor position.

 


 

bool GetSelection(int& l, int& hconst

Returns the current selection. If there is no selection, both l h return the current cursor position.

 


 

bool IsSelection() const

Returns true if there is a selection.

 


 

bool RemoveSelection()

If there is no selection, returns false, otherwise it removes selected text and returns true.

 


 

void CancelSelection()

Any selection is canceled (no characters are selected after this operation).

 


 

void Copy()

Copies selected text to clipboard.

 


 

void Undo()

Performs undo operation.

 


 

void Cut()

Cuts the selection.

 


 

void Paste()

Pastes the content of clipboard, if compatible, into the EditField.

 


 

void Erase()

Removes the content of EditField.

 


 

void SelectAll()

Selects the whole text in EditField.

 


 

void StdBar(Bar& menu)

Standard menu of EditField.

 


 

void SetText(const WString& text)

void operator=(const WString& s)

Sets the text.

 


 

void SetText(const String& t)

void SetText(const char *t)

Sets the text. Text is converted to unicode using the default charset.

 


 

const WString& GetText() const

operator const WString&() const

Returns the text.

 


 

operator String() const

Returns the text. Text is converted to unicode using the default charset.

 


 

virtual int GetLength() const

Returns the length of text.

 


 

void Clear()

Sets the empty text.

 


 

void Reset()

Resets EditField to default state.

 


 

void Error(bool error)

If error is true, paints the content as if it was invalid (the same way as when assigned Convert returns ErrorValue).

 


 

EditField& Password(bool pwd = true)

Sets the password mode. In password mode all characters are displayed as asterisk. Returns *this.

 


 

EditField& SetFilter(int (*f)(int))

Sets the character filter f. All characters keystrokes are first altered by this function and used only if the result is not zero. Returns *this.

 


 

EditField& SetConvert(const Convert& c)

Sets the Value converter. By using the specific converters, EditField can be adapted for editing any type of values with text representation. Note that EditField stores just reference to c, therefore its lifetime must exceed the lifetime of EditField. Returns *this.

 


 

EditField& SetInactiveConvert(const Convert& c)

Sets the inactive Value converter. Such converter is used to format displayed value when edit control does not own the focus. Returns *this.

 


 

EditField& SetCharset(byte cs)

Sets the encoding to cs - only characters representable in given encoding are allowed in EditField. Note that this does not impact encoding of String values returned from EditField, only acts as another filter.

 


 

EditField& AutoFormat(bool b = true)

In AutoFormat mode, when focus goes out of editfield, text representation of value is reformated by current Convert - text is converted to Value and back. This mode is active by default. Returns *this.

 


 

EditField& NoAutoFormat()

Same as AutoFormat(false).

 


 

EditField& SetFont(Font _font)

Sets the font. Returns *this.

 


 

EditField& ClickSelect(bool b = true)

In ClickSelect mode, all the text of EditField is select when clicked by mouse. Returns *this.

 


 

EditField& InitCaps(bool b = true)

In InitCaps mode, initial letters of entered text are uppercased. Returns *this.

 


 

EditField& NullText(const Image& icon, const char *text = t_("(default)"), Color ink = SColorDisabled)

EditField& NullText(const Image& icon, const char *text, Font fnt, Color ink)

EditField& NullText(const char *text = t_("(default)"), Color ink = SColorDisabled)

EditField& NullText(const char *text, Font fnt, Color ink)

In NullText mode, empty EditField displays text using ink color and fnt as a font, with icon. Returns *this.

 


 

EditField& MaxChars(int mc)

Limits maximum number of characters to mc. Returns *this.

 


 

EditField& AutoSize(int maxcx = INT_MAX)

Resizes the width of EditField according to the length of text up to maxcx width.

 


 

EditField& NoBackground(bool b = true)

Sets the widget into transparent mode - background is not painted and Transparent is activated - a result, anything painted behind the widget is visible, allowing client code to provide any background it needs.

 


 

CharFilter GetFilter() const

Returns current character filter.

 


 

const Convert& GetConvert() const

Returns current converter.

 


 

Font GetFont() const

Returns current font.

 


 

EditField& AlignRight(bool b = true)

If b.is true, the text will be displayed aligned to the right. Left alignment is default.

 


 

virtual int GetChar(int iconst

Returns the character at i index.

 


 

static const Style& StyleDefault()

Returns the default style used to draw edit fields.

 


 

EditField& SetStyle(const Style& s)

Sets the style to an EditField::Style s.

 

 

EditField::Style

 

struct Style : public ChStyle<Style> 

This structure defines the visual style of an EditField.

 

 

Страница доступна на english языке. Вы хотите внести вклад?