Table of Contents

Class SpeedTextButton

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

SpeedButton descendant which by default shows text and no image.

[ControlCategory("Other")]
public class SpeedTextButton : SpeedButton, IBaseObject, IDisposableObject, ISupportInitialize, IFocusable, ITextProperty, IComponent, IControl, IDisposable, IWin32Window, INotifyDataErrorInfo
Inheritance
SpeedTextButton
Implements

Examples

Here is how to declare a SpeedTextButton in UIXML:

<SpeedTextButton Name="button1" Click="Button_Click"
             ToolTip = "Some hint" Shortcut="Ctrl+Enter" Text="Ok" Margin="5"/>

Also, a SpeedTextButton can be created from code:

public SpeedButton CreateSpeedButton()
{
    SpeedTextButton result = new();
    result.Click += Button_Click;
    result.Text = "Cancel";
    result.ToolTip = "Some hint";
    result.Parent = buttonPanel;
    result.ShortcutKeys = Keys.Escape;
    result.Margin = 5;
    result.UseTheme = SpeedButton.KnownTheme.StaticBorder;
    return result;
}

private void MainWindow_KeyDown(object sender, KeyEventArgs e)
{
    // Shortcuts in SpeedButton are not handled by default, they are only shown in hint,
    // so here we need to handle speedbutton shortcut.
    if (e.KeyData == button2.ShortcutKeys)
    {
        Application.Log("button2 shortcut pressed");
        e.Handled = true;
    }

    if (e.KeyData == button1.ShortcutKeys)
    {
        Application.Log("button1 shortcut pressed");
        e.Handled = true;
    }
}

Remarks

Example of how a SpeedTextButton can look:

SpeedTextButton

Constructors

SpeedTextButton()

Initializes a new instance of the SpeedTextButton class.