Show / Hide Table of Contents

    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
    IComponent.Name
    IComponent.Entity
    IComponent.RegistrationType
    IComponent.Init(IEntity, Type)
    IComponent.AfterInit()
    System.IDisposable.Dispose()
    System.ComponentModel.INotifyPropertyChanged.PropertyChanged
    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 Source

    CaretFlashDelay

    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
    | Improve this Doc View Source

    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
    | Improve this Doc View Source

    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. Let's say, for example, that we don't want our textbox to allow spaces. First, we'll subscribe to the event. Then, if a space key is pressed, we'll cancel its processing. Also, let's say that our textbox is inside a dialog, and we want the enter key to close the dialog (and then do something with the text). We'll listen to the enter key in the same dialog to close it.

    _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>
    | Improve this Doc View Source

    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.

    • Improve this Doc
    • View Source
    Back to top Generated by DocFX