---
name: "CT SHORTCUTBUTTON"
type: topic
source: https://community.bistudio.com/wiki/CT_SHORTCUTBUTTON
revid: 369833
updated: 2024-10-16T07:26:33Z
---

# CT SHORTCUTBUTTON

### Introduction

A more customizable and modern version of [CT_BUTTON](../topics/CT_BUTTON.md) that also supports [Structured Text](../topics/Structured_Text.md) and an image with text at the same time (see [below](../topics/CT_SHORTCUTBUTTON.md#other-examples)).

#### Related commands & functions

- Commands: General
- Commands: UI Eventhandlers

#### Related User Interface Eventhandlers

- [Events: General](../topics/User_Interface_Event_Handlers.md#generic-events)
- [Events: Button](../topics/User_Interface_Event_Handlers.md#button-events)

### Alphabetical Order

> [!NOTE]
> TokenNames common to most controls, such as x, y, w, h, text, idc... can be found [**here**](../topics/Arma~3A_GUI_Configuration.md#common-properties).

> [!WARNING]
> Not all of the listed attributes might have an effect nor might the list be complete. All attributes were gathered with [this](https://github.com/7erra/BIKI.VR/blob/master/fnc/generateCTPage.sqf) config crawler.

```cpp
#define CT_SHORTCUTBUTTON 16
```

#### A

##### action

**Type:** String

**Description:** SQS code executed when button is clicked.

```cpp
action = "if (profilenamespace getvariable ['BIS_fnc_init_recompileEditor',false]) then {[1] call (uinamespace getvariable 'BIS_fnc_recompile')}";
```

##### animTextureDefault

**Type:** String

**Description:** n/a

```cpp
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
```

##### animTextureDisabled

**Type:** String

**Description:** n/a

```cpp
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
```

##### animTextureFocused

**Type:** String

**Description:** n/a

```cpp
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
```

##### animTextureNormal

**Type:** String

**Description:** n/a

```cpp
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
```

##### animTextureOver

**Type:** String

**Description:** n/a

```cpp
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
```

##### animTexturePressed

**Type:** String

**Description:** n/a

```cpp
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
```

##### Attributes

**Type:** Class

**Description:** Attributes of the text (Only 'font' has effect). See [Structured Text control text attributes](../topics/CT_STRUCTURED_TEXT.md#attributes).

```cpp
class Attributes
{
    font = "PuristaLight";
    color = "#E5E5E5";
    align = "left";
    shadow = "false";
};
```

##### AttributesImage

**Type:** Class

**Description:** n/a

```cpp
class AttributesImage
{
    font = "RobotoCondensed";
    color = "#E5E5E5";
    align = "left";
};
```

##### autoAdjustTexture

**Type:** Boolean

**Description:** Introduced with Arma 3 v2.10. Default: [false](../commands/false.md). When this attribute set to [true](../commands/true.md) the texture will be rendered in the following way:

- If the original texture aspect ratio is 2:1 or more (`w >= 2 * h`) and the button aspect ration is 2:1 or more (`w >= 2 * h`), the corners of the texture are preserved (rounded corners would scale but not stretch).
- In all other cases the texture is stretched to cover the button.

```cpp
autoAdjustTexture = true;
```

#### C

##### color

**Type:** Array

**Description:** Text color.

```cpp
color[] = {1,1,1,1};
```

##### color2

**Type:** Array

**Description:** When hovering over the button the text color changes from color[] to color2[].

```cpp
color2[] = {0.95,0.95,0.95,1};
```

##### color2Secondary

**Type:** Array

**Description:** n/a

```cpp
color2Secondary[] = {0,0,0,1};
```

##### colorBackground2

**Type:** Array

**Description:** When hovering over the button the background color changes from colorBackground[] to colorBackground2[].

```cpp
colorBackground2[] = {1,1,1,1};
```

##### colorBackgroundActive

**Type:** Array

**Description:** n/a

```cpp
colorBackgroundActive[] = {"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])","(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])","(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",1};
```

##### colorBackgroundFocused

**Type:** Array

**Description:** Color of the background when the control is focused.

```cpp
colorBackgroundFocused[] = {1,1,1,1};
```

##### colorDisabledSecondary

**Type:** Array

**Description:** n/a

```cpp
colorDisabledSecondary[] = {1,1,1,0.25};
```

##### colorFocused

**Type:** Array

**Description:** Text color when the control is focused.

```cpp
colorFocused[] = {0,0,0,1};
```

##### colorFocusedSecondary

**Type:** Array

**Description:** n/a

```cpp
colorFocusedSecondary[] = {0,0,0,1};
```

##### colorSecondary

**Type:** Array

**Description:** n/a

```cpp
colorSecondary[] = {1,1,1,1};
```

#### D

##### default

**Type:** Number

**Description:** If set to 1, this control is focused when the GUI is opened.

```cpp
default = 1;
```

#### F

##### fontSecondary

**Type:** String

**Description:** n/a

```cpp
fontSecondary = "PuristaLight";
```

#### H

##### HitZone

**Type:** Class

**Description:** n/a

```cpp
class HitZone
{
    left = 0;
    top = 0;
    right = 0;
    bottom = 0;
};
```

#### K

##### KeyHints

**Type:** Class

**Description:** n/a

```cpp
class KeyHints
{
    class A
    {
        key = "0x00050000 + 0";
        hint = "";
    };
};
```

#### P

##### period

**Type:** Number

**Description:** Blinking period.

```cpp
period = 1.2;
```

##### periodFocus

**Type:** Number

**Description:** Blinking period when focused.

```cpp
periodFocus = 1.2;
```

##### periodOver

**Type:** Number

**Description:** Blinking period when mouse is hovering over the button.

```cpp
periodOver = 1.2;
```

#### S

##### ShortcutPos

**Type:** Class

**Description:** Position of the texture used on the button.

```cpp
class ShortcutPos
{
    left = "5.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
    top = 0;
    w = "1 * (((safezoneW / safezoneH) min 1.2) / 40)";
    h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
```

##### shortcuts

**Type:** Array

**Description:** Key shortcuts. often over-ridden/ignored by engine.

```cpp
shortcuts[] = {"0x00050000 + 1"};
```

##### shpw

**Type:** Number

**Description:** Typo for **show**. See common attributes.

```cpp
shpw = 0;
```

##### sizeExSecondary

**Type:** String

**Description:** n/a

```cpp
sizeExSecondary = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
```

##### soundClick

**Type:** Array

**Description:** n/a

```cpp
soundClick[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundClick",0.09,1};
```

##### soundEnter

**Type:** Array

**Description:** n/a

```cpp
soundEnter[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",0.09,1};
```

##### soundEscape

**Type:** Array

**Description:** n/a

```cpp
soundEscape[] = {"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",0.09,1};
```

##### soundPush

**Type:** Array

**Description:** n/a

```cpp
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush",0.09,1};
```

#### T

##### TextPos

**Type:** Class

**Description:** Position of the text. Useful for aligning with [ShortcutPos](../topics/CT_SHORTCUTBUTTON.md#shortcutpos).

```cpp
class TextPos
{
    left = 0;
    top = "(1*(safezoneH / 40) - (0.028*SafezoneH)) / 2";
    right = 0.005;
    bottom = 0;
    forceMiddle = true; // Since Arma 3 v2.10, default false. When true, text will be forced in the middle of the button vertically
};
```

##### textSecondary

**Type:** String

**Description:** Sets the secondary text of the button.

```cpp
textSecondary = "";
```

##### textureNoShortcut

**Type:** String

**Description:** A custom Texture to be displayed alongside text. Position can be set in the ShortcutPos (texture) and TextPos (text) class.

```cpp
textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
```

#### U

##### url

**Type:** String

**Description:** Link to open when clicked.

```cpp
url = "https://steamcommunity.com/workshop/browse?appid=107410";
```

### Default Classes

> [!NOTE]
> **Arma 3:** **AddOns:** Classes need to be initialised first with `class SomeClass;`
>
> ---
>
> **Missions:** Since Arma 3 v2.02 one can use `import SomeClass;` to initialise a class (see the [import](../topics/import_~28Config~29.md) keyword).
>
> In older versions, use `"Default" call BIS_fnc_exportGUIBaseClasses;` and paste the result into the [description.ext](../topics/Description.ext.md).

#### RscShortcutButton

An older version of the shortcut button.

```cpp
class RscShortcutButton
{
    deletable = 0;
    fade = 0;
    type = CT_SHORTCUTBUTTON;
    x = 0.1;
    y = 0.1;
    class HitZone
    {
        left = 0;
        top = 0;
        right = 0;
        bottom = 0;
    };
    class ShortcutPos
    {
        left = 0;
        top = ((GUI_GRID_HAbs / 20) - GUI_TEXT_SIZE_MEDIUM) / 2;
        w = GUI_TEXT_SIZE_MEDIUM * (3/4);
        h = GUI_TEXT_SIZE_MEDIUM;
    };
    class TextPos
    {
        left = GUI_TEXT_SIZE_MEDIUM * (3/4);
        top = ((GUI_GRID_HAbs / 20) - GUI_TEXT_SIZE_MEDIUM) / 2;
        right = 0.005;
        bottom = 0;
    };
    shortcuts[] = {};
    textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
    color[] = {1,1,1,1};
    colorFocused[] = {1,1,1,1};
    color2[] = {0.95,0.95,0.95,1};
    colorDisabled[] = {1,1,1,0.25};
    colorBackground[] =
    {
        "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
        "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
        "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
        1
    };
    colorBackgroundFocused[] =
    {
        "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
        "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
        "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
        1
    };
    colorBackground2[] = {1,1,1,1};
    soundEnter[] =
    {
        "\A3\ui_f\data\sound\RscButton\soundEnter",
        0.09,
        1
    };
    soundPush[] =
    {
        "\A3\ui_f\data\sound\RscButton\soundPush",
        0.09,
        1
    };
    soundClick[] =
    {
        "\A3\ui_f\data\sound\RscButton\soundClick",
        0.09,
        1
    };
    soundEscape[] =
    {
        "\A3\ui_f\data\sound\RscButton\soundEscape",
        0.09,
        1
    };
    class Attributes
    {
        font = "RobotoCondensed";
        color = "#E5E5E5";
        align = "left";
        shadow = "true";
    };
    idc = -1;
    style = ST_LEFT;
    default = 0;
    shadow = 1;
    w = 0.183825;
    h = (GUI_GRID_HAbs / 20);
    textSecondary = "";
    colorSecondary[] = {1,1,1,1};
    colorFocusedSecondary[] = {1,1,1,1};
    color2Secondary[] = {0.95,0.95,0.95,1};
    colorDisabledSecondary[] = {1,1,1,0.25};
    sizeExSecondary = GUI_TEXT_SIZE_MEDIUM;
    fontSecondary = "RobotoCondensed";
    animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
    animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
    animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
    animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa";
    animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa";
    animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa";
    periodFocus = 1.2;
    periodOver = 0.8;
    period = 0.4;
    font = "RobotoCondensed";
    size = GUI_TEXT_SIZE_MEDIUM;
    sizeEx = GUI_TEXT_SIZE_MEDIUM;
    text = "";
    url = "";
    action = "";
    class AttributesImage
    {
        font = "RobotoCondensed";
        color = "#E5E5E5";
        align = "left";
    };
};
```

#### RscButtonMenu

The modern Arma 3 button like the ones in the escape display.

```cpp
class RscButtonMenu : RscShortcutButton
{
    idc = -1;
    type = CT_SHORTCUTBUTTON;
    style = ST_CENTER + ST_FRAME + ST_HUD_BACKGROUND;
    default = 0;
    shadow = 0;
    x = 0;
    y = 0;
    w = 0.095589;
    h = 0.039216;
    animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
    animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
    animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
    colorBackground[] = {0,0,0,0.8};
    colorBackgroundFocused[] = {1,1,1,1};
    colorBackground2[] = {0.75,0.75,0.75,1};
    color[] = {1,1,1,1};
    colorFocused[] = {0,0,0,1};
    color2[] = {0,0,0,1};
    colorText[] = {1,1,1,1};
    colorDisabled[] = {1,1,1,0.25};
    textSecondary = "";
    colorSecondary[] = {1,1,1,1};
    colorFocusedSecondary[] = {0,0,0,1};
    color2Secondary[] = {0,0,0,1};
    colorDisabledSecondary[] = {1,1,1,0.25};
    sizeExSecondary = GUI_TEXT_SIZE_MEDIUM;
    fontSecondary = "PuristaLight";
    period = 1.2;
    periodFocus = 1.2;
    periodOver = 1.2;
    size = GUI_TEXT_SIZE_MEDIUM;
    sizeEx = GUI_TEXT_SIZE_MEDIUM;
    tooltipColorText[] = {1,1,1,1};
    tooltipColorBox[] = {1,1,1,1};
    tooltipColorShade[] = {0,0,0,0.65};
    class TextPos
    {
        left = 0.25 * GUI_GRID_W;
        top = (GUI_GRID_H - GUI_TEXT_SIZE_MEDIUM) / 2;
        right = 0.005;
        bottom = 0;
    };
    class Attributes
    {
        font = "PuristaLight";
        color = "#E5E5E5";
        align = "left";
        shadow = "false";
    };
    class ShortcutPos
    {
        left = 5.25 * GUI_GRID_W;
        top = 0;
        w = 1 * GUI_GRID_W;
        h = 1 * GUI_GRID_H;
    };
    soundEnter[] =
    {
        "\A3\ui_f\data\sound\RscButtonMenu\soundEnter",
        0.09,
        1
    };
    soundPush[] =
    {
        "\A3\ui_f\data\sound\RscButtonMenu\soundPush",
        0.09,
        1
    };
    soundClick[] =
    {
        "\A3\ui_f\data\sound\RscButtonMenu\soundClick",
        0.09,
        1
    };
    soundEscape[] =
    {
        "\A3\ui_f\data\sound\RscButtonMenu\soundEscape",
        0.09,
        1
    };
};
```

### Other examples

This is an example with an image and text combined in one control.

```cpp
class RscButtonMenuSteam : RscButtonMenu
{
    text = "STEAM";
    colorBackground[] = {0.03137255,0.72156864,0.91764706,1.0};
    textureNoShortcut = "\A3\Ui_f\data\GUI\RscCommon\RscButtonMenuSteam\steam_ca.paa";
    class TextPos
    {
        left = 0.0325;
        top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
        right = 0.005;
        bottom = 0.0;
    };
    class ShortcutPos
    {
        left = 0.005;
        top = 0.005;
        w = 0.0225;
        h = 0.03;
    };
};
```

<sub>Source: [BI Community Wiki — CT SHORTCUTBUTTON](https://community.bistudio.com/wiki/CT_SHORTCUTBUTTON) (revision 369833).</sub>
