mirror of
https://github.com/psychopy/psychojs.git
synced 2025-05-12 16:48:10 +00:00
Merge pull request #164 from thewhodidthis/bf#159+160--textbox
visual/TextBox: Add methods for accessing the underlying input text
This commit is contained in:
commit
413f6d60a3
@ -165,6 +165,53 @@ export class TextBox extends util.mix(VisualStim).with(ColorMixin)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current text value.
|
||||||
|
*
|
||||||
|
* @name module:visual.TextBox#reset
|
||||||
|
* @public
|
||||||
|
*/
|
||||||
|
reset()
|
||||||
|
{
|
||||||
|
this.setText();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For tweaking the underlying input value.
|
||||||
|
*
|
||||||
|
* @name module:visual.TextBox#setText
|
||||||
|
* @public
|
||||||
|
* @param {string} text
|
||||||
|
*/
|
||||||
|
setText(text = '')
|
||||||
|
{
|
||||||
|
if (typeof this._pixi !== 'undefined')
|
||||||
|
{
|
||||||
|
this._pixi.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
this._text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For accessing the underlying input value.
|
||||||
|
*
|
||||||
|
* @name module:visual.TextBox#getText
|
||||||
|
* @public
|
||||||
|
* @return {string} - the current text value of the underlying input element.
|
||||||
|
*/
|
||||||
|
getText()
|
||||||
|
{
|
||||||
|
if (typeof this._pixi !== 'undefined')
|
||||||
|
{
|
||||||
|
return this._pixi.text;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._text;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setter for the size attribute.
|
* Setter for the size attribute.
|
||||||
|
Loading…
Reference in New Issue
Block a user