new GOWN.AutoComplete(text, theme, skinName)
The basic AutoComplete. Needed for input with suggestions
Name | Type | Default | Description |
---|---|---|---|
text |
String | Default display text | |
theme |
GOWN.Theme | optional theme for auto complete | |
skinName |
String | AutoComplete.SKIN_NAME | optional name of the auto complete skin |
Extends
Members
-
static,readonlyGOWN.AutoComplete.CLICKEDString
-
Click state
-
static,readonlyGOWN.AutoComplete.HOVER_CONTAINERString
-
Hover state
-
allowDestroyCachebool
-
Will destroy the skin cache when the skinable gets destroyed
- Default Value:
- true
-
autoPreventInteractionbool
-
Prevent other interaction (touch/move) on this component
- Default Value:
- false
-
blinkIntervalNumber
-
Interval for the cursor (in milliseconds)
- Default Value:
- 500
-
currentStateString
-
The current state TODO: move to skinable?
- Default Value:
- InputControl.UP
-
displayAsPasswordbool
-
Set display as password (show text with "*")
-
enabledBoolean
-
Enables/Disables the control. (not implemented yet)
-
hasFocusbool
-
Determine if the input has the focus
- Default Value:
- false
-
limitToNumber
-
The maximum number of suggestions that show at one time. If 0, all suggestions will be shown.
- Default Value:
- 5
-
maxCharsString
-
The maximum number of characters that may be entered. If 0, any number of characters may be entered. (same as maxLength for DOM inputs)
- Default Value:
- 0
-
minAutoCompleteLengthNumber
-
The minimum number of entered characters required to draw suggestions.
- Default Value:
- 2
-
receiveKeysbool
-
TODO
- Default Value:
- true
-
resultsArray.<String>
-
Result elements (source elements filtered by the text attribute)
- Default Value:
- []
-
selectionBgPIXI.Graphics
-
Text selection background
-
skinFallbackString
-
The fallback skin if the other skin does not exist (e.g. if a mobile theme that does not provide a "hover" state is used on a desktop system) (normally the default "up"-state skin)
- Default Value:
- 'up'
-
skinNameString
-
The skin name
- Default Value:
- TextInput.SKIN_NAME
-
sourceArray.<String>
-
Source elements from which the auto complete filters the elements corresponding to the current text
- Default Value:
- []
-
stylePIXI.TextStyle
-
Set the text style (size, font etc.) for text and cursor
-
textString
-
The displayed text
Methods
-
Blur the text input (remove focus)
-
inherited changeSkin(skin)
-
Remove old skin and add new one
Name Type Description skin
DisplayObject -
inherited deleteSelection()
-
Delete the selected text
-
inherited deleteText(fromPos, toPos){String}
-
Delete text from a start position to an end position
Name Type Description fromPos
Number start position toPos
Number end position Returns:
Type Description String -
inherited destroy()
-
Destroy the Skinable and empty the skin cache
-
drawResults(text)
-
Draw the results
Name Type Description text
String Text to filter the source elements -
inherited focus()
-
Focus on this input and set it as current
-
inherited fromSkin(name, callback)
-
Get image from skin (will execute a callback with the loaded skin when it is loaded or call it directly when it already is loaded)
Name Type Description name
String name of the state callback
function callback that is executed if the skin is loaded -
inherited getLines(){Array|*}
-
Get the text lines as an array
Returns:
Type Description Array | * Returns an array with one text line per array element -
hoverResultElement(elementText)
-
Update the hover result element
Name Type Description elementText
-
inherited insertChar(char)
-
Insert a char at the current cursor position
Name Type Description char
String The char that gets inserted -
inherited lineHeight(){Number}
-
Height of the line in pixel (assume that every character of pixi text has the same line height)
Returns:
Type Description Number -
inherited mousePos(){PIXI.Point}
-
Get the local mouse position from PIXI.InteractionData
Returns:
Type Description PIXI.Point -
inherited moveCursorLeft()
-
Move the cursor left
-
inherited moveCursorRight()
-
Move the cursor right
-
inherited protectedonblur()
-
Callback that will be executed once the text input is blurred
-
inherited protectedonDown()
-
onDown callback
-
inherited protectedonfocus()
-
Callback to execute code on focus
-
inherited protectedonInputChanged()
-
Input changed callback
-
protectedonMouseUpOutside()
-
Closes the results when the mouse is released outside
-
inherited protectedonMove()
-
onMove callback
-
inherited protectedonUp()
-
onUp callback
-
inherited pixelToTextPos(pixelPos){Number}
-
From pixel position on the text to character position inside the text (used when clicked on the text)
Name Type Description pixelPos
Pixel position of the mouse on the text Returns:
Type Description Number Position in the text -
inherited preloadSkins()
-
Initiate all skins first
-
inherited protectedredraw()
-
Update before draw call (draw cursor and selection)
-
redrawResult()
-
Redraw the results
-
removeHoverResultElement()
-
Remove the hover result element
-
selectResultElement(text)
-
Close results and set the text
Name Type Description text
String Display text -
inherited setCursorPos()
-
Set the cursor position on the text
-
setText(text)
-
Set the auto complete text. Draws the auto complete results afterwards.
Name Type Description text
String The text to set -
inherited setTheme(theme)
-
Change the theme
Name Type Description theme
GOWN.Theme the new theme -
inherited textToPixelPos(textPos, position){PIXI.Point}
-
From position in the text to pixel position (for cursor/selection positioning)
Name Type Description textPos
Number Current character position in the text position
PIXI.Point optional point that will be set with the pixel position and returned Returns:
Type Description PIXI.Point Pixel position -
inherited textWidth(text){Number}
-
Get the width of a text
Name Type Description text
String The text to get the width from Returns:
Type Description Number -
toggleResults()
-
Close the results
-
inherited updateSelection(start, end){boolean}
-
Set the selected text
Name Type Description start
Number Start position in the text end
Number End position in the text Returns:
Type Description boolean -
inherited updateTheme(data)
-
Overwrite data from theme for this specific component. (usable if you want to change e.g. background color based on selected items)
Name Type Description data
updated skin data