mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-11 16:18:10 +00:00
visual/TextBox: add methods for accessing and resetting the underlying input value
This commit is contained in:
parent
8a9b59b1c8
commit
67c606d4b2
@ -165,6 +165,49 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Clears the current text value.
|
||||
*
|
||||
* @name module:visual.TextBox#reset
|
||||
* @public
|
||||
*/
|
||||
reset()
|
||||
{
|
||||
this.setInputText();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For tweaking the underlying input value.
|
||||
*
|
||||
* @name module:visual.TextBox#setInputText
|
||||
* @public
|
||||
* @param {string} text
|
||||
*/
|
||||
setInputText(text = '')
|
||||
{
|
||||
if (typeof this._pixi !== 'undefined')
|
||||
{
|
||||
this._pixi.text = text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For accessing the underlying input value.
|
||||
*
|
||||
* @name module:visual.TextBox#getInputText
|
||||
* @public
|
||||
* @return {string} - the current text value of the underlying input element.
|
||||
*/
|
||||
getInputText()
|
||||
{
|
||||
if (typeof this._pixi !== 'undefined')
|
||||
{
|
||||
return this._pixi.text;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Setter for the size attribute.
|
||||
|
Loading…
Reference in New Issue
Block a user