The three virtues of a programmer: Laziness, Impatience, and Hubris. – Larry Wall

UE3:UIComp_DrawStringEditbox (UDK)

From Unreal Wiki, The Unreal Engine Documentation Site
Revision as of 05:48, 17 January 2010 by Wormbo (Talk | contribs) (1 revision: class descriptions for UDK January update (part 5))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
UDK Object >> Component >> UIComponent >> UIComp_DrawComponents >> UIComp_DrawString >> UIComp_DrawStringEditbox
Package: 
Engine
Within class: 
UIEditBox
Implemented interfaces
UIStyleResolver
This class in other games:
UT3

This specialized version of UIComp_DrawString handles rendering UIStrings for editboxes. The responsibilities specific to rendering text in editboxes are: 1. A caret must be rendered at the appropriate location in the string 2. Ensuring that the text surrounding the caret is always visible 3. Tracking the text that was typed by the user independently from the data source that the owning widget is bound to.

Todo: register this component with the data store for the caret image node so that it receives the refreshdatastore callback

Properties

Property group 'Appearance'

StringCaret

Type: UIRoot.UIStringCaretParameters

Controls whether and how a caret is displayed

Default value:

Member Value
CaretStyle 'DefaultCaretStyle'
CaretWidth 1.0

Internal variables

bRecalculateFirstCharacter

Type: bool

Modifiers: const, transient

indicates that the FirstCharacterPosition needs to be re-evaluated the next time the string is reformatted

CaretNode

Type: pointer{struct FUIStringNode_Image}

Modifiers: const, native, private, transient

the image node that is used for rendering the caret

CaretOffset

Type: float

Modifiers: const, transient

the offset (in pixels) from the left edge of the editbox's bounding region for rendering the caret

FirstCharacterPosition

Type: int

Modifiers: const, private, transient

the position of the first visible character in the editbox

SelectionBackgroundColor

Type: Object.LinearColor

Modifiers: config

the color to use for the background of a selected text block

Default value:

Member Value
A 0.6
B 0.019608
G 0.12549
R 0.654901

SelectionRegion

Type: UIStringSelectionRegion

Modifiers: transient

the editbox's selected text

SelectionTextColor

Type: Object.LinearColor

Modifiers: config

the color to use for selected text

Default value:

Member Value
A 1.0
B 1.0
G 1.0
R 1.0

UserText

Type: string

Modifiers: private, transient

Contains the text that the user has typed into the editbox

Default values

Property Value
StringStyle
Member Value
DefaultStyleTag 'DefaultEditboxStyle'
TextStyleCustomization
Member Value
bOverrideClipAlignment True
bOverrideClipMode True
ClipAlignment UIALIGN_Right
ClipMode CLIP_Normal

Structs

UIStringSelectionRegion

Modifiers: native, transient

Defines a range of selected text in a UIString.

int SelectionStartCharIndex 
int SelectionEndCharIndex 

Default values:

Property Value
SelectionEndCharIndex 0
SelectionStartCharIndex 0

Native functions

ClearSelection

native final function bool ClearSelection ()

Clears the current selection region.

Returns:

TRUE if the selection was cleared successfully.

GetSelectedText

native final function string GetSelectedText () const

Returns:

the string that is currently selected.

GetSelectionRange

native final function bool GetSelectionRange (out int out_StartIndex, out int out_EndIndex) const

Retrieves the indexes of start and end characters of the selection region.

Parameters:

  • out_startIndex - receives the index for the beginning of the selection region (guaranteed to be less than out_EndIndex)
  • out_EndIndex - recieves the index for the end of the selection region.

Returns:

TRUE if the selection region is valid.

GetUserTextLength

native final function int GetUserTextLength () const

Returns the length of UserText

SetSelectionEnd

native final function bool SetSelectionEnd (int EndIndex)

Sets the ending character for the selection region.

Parameters:

  • EndIndex - the index of the character that should become the end of the selection region.

Returns:

TRUE if the selection's ending index was changed successfully.

SetSelectionRange

native final function bool SetSelectionRange (int StartIndex, int EndIndex)

Change the range of selected characters in this editbox.

Parameters:

  • StartIndex - the index of the first character that should be selected.
  • EndIndex - the index of the last character that should be selected.

Returns:

TRUE if the selection was changed successfully.

SetSelectionStart

native final function bool SetSelectionStart (int StartIndex)

Sets the starting character for the selection region.

Parameters:

  • StartIndex - the index of the character that should become the start of the selection region.

Returns:

TRUE if the selection's starting index was changed successfully.

SetUserText

native final function bool SetUserText (string NewValue)

Changes the value of UserText to the specified text without affecting the

SetUserText should be used for modifying the "input text"; that is, the text that would potentially be published to the data store this editbox is bound to. SetValue should be used to change the raw string that will be parsed by the underlying UIString. UserText will be set to the resolved value of the parsed string.

Parameters:

  • NewText - the new text that should be displayed

Returns:

TRUE if the value changed.