Panda3D

- Main Page
- Packages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# PGEntry Class Reference

This is a particular kind of PGItem that handles simple one-line or short multi-line text entries, of the sort where the user can type any string. More...

Inheritance diagram for PGEntry:

List of all members.

## Public Types
enum | State { SFocus = 0, SNoFocus = 1, SInactive = 2 }
## Public Member Functions
| PGEntry (string name)
| clearCursorDef ()
| Removes all the children from the cursor_def node, in preparation for adding a new definition.
string | getAcceptEvent (ButtonHandle const button)
| Returns the event name that will be thrown when the entry is accepted normally.
string | getAcceptFailedEvent (ButtonHandle const button)
| Returns the event name that will be thrown when the entry cannot accept an input.
float | getBlinkRate ()
| Returns the number of times per second the cursor will blink, or 0 if the cursor is not to blink.
string | getCandidateActive ()
| See set_candidate_active().
string | getCandidateInactive ()
| See set_candidate_inactive().
wchar_t | getCharacter (int n)
| Returns the character at the indicated position in the entry.
NodePath | getCursorDef ()
| Returns the Node that will be rendered to represent the cursor.
bool | getCursorKeysActive ()
| Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_keys_active().
string | getCursormoveEvent ()
| Returns the event name that will be thrown whenever the cursor moves.
int | getCursorPosition ()
| Returns the current position of the cursor.
float | getCursorX ()
| Returns the node position x of the cursor.
float | getCursorY ()
| Returns the node position y of the cursor.
string | getEraseEvent ()
| Returns the event name that will be thrown whenever the user erases characters in the text.
TextGraphic const | getGraphic (int n)
| Returns the graphic object at the indicated position in the pre-wordwrapped string.
int | getMaxChars ()
| Returns the current maximum number of characters that may be typed into the entry, or 0 if there is no limit.
float | getMaxWidth ()
| Returns the current maximum width of the characters that may be typed into the entry, or 0 if there is no limit.
int | getNumCharacters ()
| Returns the number of characters of text in the entry.
int | getNumLines ()
| Returns the number of lines of text the PGEntry will use, if _max_width is not 0.
bool | getObscureMode ()
| Specifies whether obscure mode is enabled.
string | getOverflowEvent ()
| Returns the event name that will be thrown when too much text is attempted to be entered into the PGEntry, exceeding either the limit set via set_max_chars() or via set_max_width().
bool | getOverflowMode ()
| Specifies whether overflow mode is enabled.
string | getPlainText ()
| Returns the text currently displayed within the entry, without any embedded properties characters.
string | getPlainWtext ()
| Returns the text currently displayed within the entry, without any embedded properties characters.
TextProperties const | getProperties (int n)
| Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped string.
string | getText ()
| Returns the text currently displayed within the entry.
TextNode | getTextDef (int state)
| Returns the TextNode that will be used to render the text within the entry when the entry is in the indicated state.
string | getTypeEvent ()
| Returns the event name that will be thrown whenever the user extends the text by typing.
string | getWtext ()
| Returns the text currently displayed within the entry.
bool | isWtext ()
| Returns true if any of the characters in the string returned by get_wtext() are out of the range of an ASCII character (and, therefore, get_wtext() should be called in preference to get_text()).
| setAcceptEnabled (bool enabled)
| Sets whether the input may be accepted--use to disable submission by the user.
| setBlinkRate (float blink_rate)
| Sets the number of times per second the cursor will blink while the entry has keyboard focus.
| setCandidateActive (string candidate_active)
| Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages.
| setCandidateInactive (string candidate_inactive)
| Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages.
| setCursorKeysActive (bool flag)
| Sets whether the arrow keys (and home/end) control movement of the cursor.
| setCursorPosition (int position)
| Sets the current position of the cursor.
| setMaxChars (int max_chars)
| Sets the maximum number of characters that may be typed into the entry.
| setMaxWidth (float max_width)
| Sets the maximum width of all characters that may be typed into the entry.
| setNumLines (int num_lines)
| Sets the number of lines of text the PGEntry will use.
| setObscureMode (bool flag)
| Specifies whether obscure mode should be enabled.
| setOverflowMode (bool flag)
| Specifies whether overflow mode should be enabled.
bool | setText (string text)
| Changes the text currently displayed within the entry.
| setTextDef (int state, TextNode node)
| Changes the TextNode that will be used to render the text within the entry when the entry is in the indicated state.
| setup (float width, int num_lines)
| Sets up the entry for normal use.
| setupMinimal (float width, int num_lines)
| Sets up the entry without creating any frame or other decoration.
bool | setWtext (string wtext)
| Changes the text currently displayed within the entry.
## Static Public Member Functions
static string | getAcceptFailedPrefix ()
| Returns the prefix that is used to define the accept failed event for all PGEntries.
static string | getAcceptPrefix ()
| Returns the prefix that is used to define the accept event for all PGEntries.
static TypeHandle | getClassType ()
static string | getCursormovePrefix ()
| Returns the prefix that is used to define the cursor event for all PGEntries.
static string | getErasePrefix ()
| Returns the prefix that is used to define the erase event for all PGEntries.
static string | getOverflowPrefix ()
| Returns the prefix that is used to define the overflow event for all PGEntries.
static string | getTypePrefix ()
| Returns the prefix that is used to define the type event for all PGEntries.

## Detailed Description

This is a particular kind of PGItem that handles simple one-line or short multi-line text entries, of the sort where the user can type any string.

A PGEntry does all of its internal manipulation on a wide string, so it can store the full Unicode character set. The interface can support either the wide string getters and setters, or the normal 8-bit string getters and setters, which use whatever encoding method is specified by the associated TextNode.

## Member Enumeration Documentation

enum State

Enumerator:

  SFocus |
  SNoFocus |
  SInactive |

## Constructor & Destructor Documentation

PGEntry | ( | string | name | ) |

## Member Function Documentation

clearCursorDef | ( |  | ) |

Removes all the children from the cursor_def node, in preparation for adding a new definition.

string getAcceptEvent | ( | ButtonHandle const | button | ) |

Returns the event name that will be thrown when the entry is accepted normally.

string getAcceptFailedEvent | ( | ButtonHandle const | button | ) |

Returns the event name that will be thrown when the entry cannot accept an input.

static string getAcceptFailedPrefix | ( |  | ) | `[static]`

Returns the prefix that is used to define the accept failed event for all PGEntries.

This event is the concatenation of this string followed by get_id().

static string getAcceptPrefix | ( |  | ) | `[static]`

Returns the prefix that is used to define the accept event for all PGEntries.

The accept event is the concatenation of this string followed by get_id().

float getBlinkRate | ( |  | ) |

Returns the number of times per second the cursor will blink, or 0 if the cursor is not to blink.

string getCandidateActive | ( |  | ) |

See set_candidate_active().

string getCandidateInactive | ( |  | ) |

See set_candidate_inactive().

wchar_t getCharacter | ( | int | n | ) |

Returns the character at the indicated position in the entry.

If the object at this position is a graphic object instead of a character, returns 0.

static TypeHandle getClassType | ( |  | ) | `[static]`

Reimplemented from PGItem.

NodePath getCursorDef | ( |  | ) |

Returns the Node that will be rendered to represent the cursor.

You can attach suitable cursor geometry to this node.

bool getCursorKeysActive | ( |  | ) |

Returns whether the arrow keys are currently set to control movement of the cursor; see set_cursor_keys_active().

string getCursormoveEvent | ( |  | ) |

Returns the event name that will be thrown whenever the cursor moves.

static string getCursormovePrefix | ( |  | ) | `[static]`

Returns the prefix that is used to define the cursor event for all PGEntries.

The cursor event is the concatenation of this string followed by get_id().

int getCursorPosition | ( |  | ) |

Returns the current position of the cursor.

float getCursorX | ( |  | ) |

Returns the node position x of the cursor.

float getCursorY | ( |  | ) |

Returns the node position y of the cursor.

string getEraseEvent | ( |  | ) |

Returns the event name that will be thrown whenever the user erases characters in the text.

static string getErasePrefix | ( |  | ) | `[static]`

Returns the prefix that is used to define the erase event for all PGEntries.

The erase event is the concatenation of this string followed by get_id().

TextGraphic const getGraphic | ( | int | n | ) |

Returns the graphic object at the indicated position in the pre-wordwrapped string.

If the object at this position is a character instead of a graphic object, returns NULL.

int getMaxChars | ( |  | ) |

Returns the current maximum number of characters that may be typed into the entry, or 0 if there is no limit.

See set_max_chars().

float getMaxWidth | ( |  | ) |

Returns the current maximum width of the characters that may be typed into the entry, or 0 if there is no limit.

See set_max_width().

int getNumCharacters | ( |  | ) |

Returns the number of characters of text in the entry.

This is the actual number of visible characters, not counting implicit newlines due to wordwrapping, or formatted characters for text properties changes. If there is an embedded TextGraphic object, it counts as one character.

This is also the length of the string returned by get_plain_text().

int getNumLines | ( |  | ) |

Returns the number of lines of text the PGEntry will use, if _max_width is not 0.

See set_num_lines().

bool getObscureMode | ( |  | ) |

Specifies whether obscure mode is enabled.

See set_obscure_mode().

string getOverflowEvent | ( |  | ) |

Returns the event name that will be thrown when too much text is attempted to be entered into the PGEntry, exceeding either the limit set via set_max_chars() or via set_max_width().

bool getOverflowMode | ( |  | ) |

Specifies whether overflow mode is enabled.

See set_overflow_mode().

static string getOverflowPrefix | ( |  | ) | `[static]`

Returns the prefix that is used to define the overflow event for all PGEntries.

The overflow event is the concatenation of this string followed by get_id().

string getPlainText | ( |  | ) |

Returns the text currently displayed within the entry, without any embedded properties characters.

This uses the Unicode encoding currently specified for the "focus" TextNode; therefore, the TextNode must exist before calling get_text().

string getPlainWtext | ( |  | ) |

Returns the text currently displayed within the entry, without any embedded properties characters.

TextProperties const getProperties | ( | int | n | ) |

Returns the TextProperties in effect for the object at the indicated position in the pre-wordwrapped string.

string getText | ( |  | ) |

Returns the text currently displayed within the entry.

This uses the Unicode encoding currently specified for the "focus" TextNode; therefore, the TextNode must exist before calling get_text().

TextNode getTextDef | ( | int | state | ) |

Returns the TextNode that will be used to render the text within the entry when the entry is in the indicated state.

See set_text_def().

string getTypeEvent | ( |  | ) |

Returns the event name that will be thrown whenever the user extends the text by typing.

static string getTypePrefix | ( |  | ) | `[static]`

Returns the prefix that is used to define the type event for all PGEntries.

The type event is the concatenation of this string followed by get_id().

string getWtext | ( |  | ) |

Returns the text currently displayed within the entry.

bool isWtext | ( |  | ) |

Returns true if any of the characters in the string returned by get_wtext() are out of the range of an ASCII character (and, therefore, get_wtext() should be called in preference to get_text()).

setAcceptEnabled | ( | bool | enabled | ) |

Sets whether the input may be accepted--use to disable submission by the user.

setBlinkRate | ( | float | blink_rate | ) |

Sets the number of times per second the cursor will blink while the entry has keyboard focus.

If this is 0, the cursor does not blink, but is held steady.

setCandidateActive | ( | string | candidate_active | ) |

Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages.

Each candidate string represents one possible way to interpret the sequence of keys the user has just entered; it should not be considered typed yet, but it is important for the user to be able to see what he is considering entering.

This particular method sets the properties for the subset of the current candidate string that the user can actively scroll through.

setCandidateInactive | ( | string | candidate_inactive | ) |

Specifies the name of the TextProperties structure added to the TextPropertiesManager that will be used to render candidate strings from the IME, used for typing characters in east Asian languages.

Each candidate string represents one possible way to interpret the sequence of keys the user has just entered; it should not be considered typed yet, but it is important for the user to be able to see what he is considering entering.

This particular method sets the properties for the subset of the current candidate string that the user is not actively scrolling through.

setCursorKeysActive | ( | bool | flag | ) |

Sets whether the arrow keys (and home/end) control movement of the cursor.

If true, they are active; if false, they are ignored.

setCursorPosition | ( | int | position | ) |

Sets the current position of the cursor.

This is the position within the text at which the next letter typed by the user will be inserted; normally it is the same as the length of the text.

setMaxChars | ( | int | max_chars | ) |

Sets the maximum number of characters that may be typed into the entry.

This is a limit on the number of characters, as opposed to the width of the entry; see also set_max_width().

If this is 0, there is no limit.

setMaxWidth | ( | float | max_width | ) |

Sets the maximum width of all characters that may be typed into the entry.

This is a limit on the width of the formatted text, not a fixed limit on the number of characters; also set_max_chars().

If this is 0, there is no limit.

If _num_lines is more than 1, rather than being a fixed width on the whole entry, this becomes instead the wordwrap width (and the width limit on the entry is essentially _max_width * _num_lines).

setNumLines | ( | int | num_lines | ) |

Sets the number of lines of text the PGEntry will use.

This only has meaning if _max_width is not 0; _max_width indicates the wordwrap width of each line.

setObscureMode | ( | bool | flag | ) |

Specifies whether obscure mode should be enabled.

In obscure mode, a string of asterisks is displayed instead of the literal text, e.g. for entering passwords.

In obscure mode, the width of the text is computed based on the width of the string of asterisks, not on the width of the actual text. This has implications on the maximum length of text that may be entered if max_width is in effect.

setOverflowMode | ( | bool | flag | ) |

Specifies whether overflow mode should be enabled.

In overflow mode, text can overflow the boundaries of the Entry element horizontally.

Overflow mode only works when the number of lines is 1.

bool setText | ( | string | text | ) |

Changes the text currently displayed within the entry.

This uses the Unicode encoding currently specified for the "focus" TextNode; therefore, the TextNode must exist before calling set_text().

The return value is true if all the text is accepted, or false if some was truncated (see set_max_width(), etc.).

setTextDef | ( | int | state,
|  | TextNode | node
| ) |  |

Changes the TextNode that will be used to render the text within the entry when the entry is in the indicated state.

The default if nothing is specified is the same TextNode returned by PGItem.get_text_node().

setup | ( | float | width,
|  | int | num_lines
| ) |  |

Sets up the entry for normal use.

The width is the maximum width of characters that will be typed, and num_lines is the integer number of lines of text of the entry. Both of these together determine the size of the entry, based on the TextNode in effect.

setupMinimal | ( | float | width,
|  | int | num_lines
| ) |  |

Sets up the entry without creating any frame or other decoration.

bool setWtext | ( | string | wtext | ) |

Changes the text currently displayed within the entry.

The return value is true if all the text is accepted, or false if some was truncated (see set_max_width(), etc.).

All Classes Namespaces Functions Variables Enumerations Enumerator Properties