Interface ITextBoxComponent
This component allows us to create a textbox control (a UI control which allows keyboard input to print text on screen).
Inherited Members
Namespace: AGS.API
Assembly: AGS.API.dll
Syntax
[RequiredComponent(typeof(ITextComponent), true)]
[RequiredComponent(typeof(IUIEvents), true)]
[RequiredComponent(typeof(ITranslateComponent), true)]
[RequiredComponent(typeof(IDrawableInfoComponent), true)]
[RequiredComponent(typeof(IInObjectTreeComponent), true)]
[RequiredComponent(typeof(IHasRoomComponent), true)]
[RequiredComponent(typeof(IImageComponent), true)]
[RequiredComponent(typeof(IVisibleComponent), true)]
[RequiredComponent(typeof(IAnimationComponent), false)]
public interface ITextBoxComponent : IComponent, IDisposable, INotifyPropertyChanged
Properties
| Improve this Doc View SourceCaretFlashDelay
Sets the number of frames will wait for flashing the caret. The default is 10, meaning the caret will be shown for 10 frames, hidden for 10 frames, and so on.
Declaration
uint CaretFlashDelay { get; set; }
Property Value
Type | Description |
---|---|
System.UInt32 |
IsFocused
Gets or sets whether the textbox is focused or not. Only when the textbox is focused it can receive input from the keyboard (and the caret is shown). The textbox automatically gets focus when clicked, and loses focus when the user clicks somewhere else.
Declaration
bool IsFocused { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
OnPressingKey
This event can be subscribed to get notifications when keys are pressed.
You can also use this event to cancel processing (or perform special processing) for specific keys.
_myTextbox.OnPressingKey.Subscribe(onPressingKey);
...
...
private void onPressingKey(TextboxKeyPressingEventArgs args)
{
if (args.Key == Key.Space)
{
args.ShouldCancel = true;
return;
}
if (args.Key == Key.Enter)
{
args.ShouldCancel = true;
_myTextbox.IsFocused = false;
_myDialog.Close();
doSomethingWithText(_myTextbox.Text);
}
}
Declaration
IBlockingEvent<TextBoxKeyPressingEventArgs> OnPressingKey { get; }
Property Value
Type | Description |
---|---|
IBlockingEvent<TextBoxKeyPressingEventArgs> |
Watermark
An optional label that can act as a watermark. A watermark is for text which is shown in the textbox when it's empty and out of focus. An example of a watermark can be seen here: https://marketplace.visualstudio.com/items?itemName=havardhu.WatermarkTextBoxControl
Declaration
ILabel Watermark { get; set; }
Property Value
Type | Description |
---|---|
ILabel | The watermark label. |