Contents Up Previous Next

wxText: wxItem

A text item is an area of editable text, with an optional label displayed in front of it.

The callback function specified for the text item will be called for the following events:

wxText::wxText
wxText::~wxText
wxText::Copy
wxText::Create
wxText::Cut
wxText::GetInsertionPoint
wxText::GetLastPosition
wxText::GetValue
wxText::Paste
wxText::Remove
wxText::Replace
wxText::SetEditable
wxText::SetInsertionPoint
wxText::SetInsertionPointEnd
wxText::SetSelection
wxText::SetValue


wxText::wxText

void wxText(void)

Constructor, for deriving classes.

void wxText(wxPanel *parent, wxFunction func, char *label,
char *value = "", int x = -1, int y = -1, int width = -1, int height = -1,
long style = 0, char *name = "text")

Constructor, creating and showing a text item with the given string value.

func may be NULL; otherwise it is used as the callback for the list box. Note that the cast (wxFunction) must be used when passing your callback function name, or the compiler may complain that the function does not match the constructor declaration.

If label is non-NULL, it will be used to label the text item.

The parameters x and y are used to specify an absolute position, or a position after the previous panel item if omitted or default.

If width or height are omitted (or are less than zero), an appropriate size will be used for the item.

The style parameter can be a bit list of the following:

wxTE_PROCESS_ENTER The callback function will receive the message wxEVENT_TYPE_TEXT_ENTER_COMMAND. Note that this will break tab traversal for this panel item under Windows.
wxTE_PASSWORD The text will be echoed as asterisks.
wxTE_READONLY The text will not be user-editable.
wxFIXED_LENGTH Allows the values of a column of items to be left-aligned. Create an item with this style, and pad out your labels with spaces to the same length. The item labels will initially created with a string of identical characters, positioning all the values at the same x-position. Then the real label is restored.

The name parameter is used to associate a name with the item, allowing the application user to set Motif resource values for individual text items.


wxText::~wxText

void ~wxText(void)

Destructor, destroying the text item.


wxText::Copy

void Copy(void)

Copies the selected text to the clipboard under Motif and MS Windows.


wxText::Create

Bool Create(wxPanel *parent, wxFunction func, char *label,
char *value = "", int x = -1, int y = -1, int width = -1, int height = -1,
long style = 0, char *name = "text")

Creates the text item for two-step construction. Derived classes should call or replace this function. See wxText::wxText for further details.


wxText::Cut

void Cut(void)

Copies the selected text to the clipboard and removes the selection. Windows and Motif only.


wxText::GetInsertionPoint

long GetInsertionPoint(void)

Returns the insertion point. Windows and Motif only.


wxText::GetLastPosition

long GetLastPosition(void)

Returns the last position in the text item. Windows and Motif only.


wxText::GetValue

char * GetValue(void)

Gets a pointer to the current value. Copy this for long-term use.


wxText::Paste

void Paste(void)

Pastes text from the clipboard to the text item. Windows and Motif only.


wxText::Remove

void Remove(long from, long to)

Removes the text between the two positions. Windows and Motif only.


wxText::Replace

void Replace(long from, long to, char *value)

Replaces the text between two positions with the given text. Windows and Motif only.


wxText::SetEditable

void SetEditable(Bool editable)

Makes the text item editable (TRUE) or read-only (FALSE).


wxText::SetInsertionPoint

void SetInsertionPoint(long pos)

Sets the insertion point. Windows only.


wxText::SetInsertionPointEnd

void SetInsertionPointEnd(void)

Sets the insertion point at the end of the text item. Windows and Motif only.


wxText::SetSelection

void SetSelection(long from, long to)

Selects the text between the two positions. Windows and Motif only.


wxText::SetValue

void SetValue(char * value)

Sets the text. value must be deallocated by the calling program.