Arma 3 Scripting

CT CONTROL REF

Topic · Markdown · JSON · original wiki page

Arma 3 v2.24

Introduction

Renders a different references control, in the position of this control.
ctrlWebBrowserAction can be used to change the source control.

The reference control holds a weak reference/link to the source control. If the source is closed, the reference will display nothing as if it were an empty control.

Alphabetical Order

Note

TokenNames common to most controls, such as x, y, w, h, text, idc... can be found here.

Warning

Not all of the listed attributes might have an effect nor might the list be complete. All attributes were gathered with this config crawler.

#define CT_CONTROL_REF 108

Scripting

Note

See ctrlWebBrowserAction.

Example

Here is an example. First there is a Display that contains a WebBrowser control. Then a second Display, renders the WebBrowser control of the first display.

description.ext:

class RscDisplayBrowser
{
    idd=157;
    class Controls
    {
        class WebTest: RscText
        {
            type=106;
            idc=1337;
            x="0";
            y="0";
            w="1";
            h="1";

            url = "arma://test.html"; // You need to create your own html file to test this with and place it in your mission folder
        };
    };
    // Init script to store it in variable so we can find it later, and EachFrame updating because this will be put on a ui2texture
    onLoad = "GMyData = _this, uiNamespace setVariable ['GMyData', _this]; addMissionEventHandler ['EachFrame', {_disp = _thisArgs#0; displayUpdate _disp;}, [_this#0]];";
};

class RscDisplayRef
{
    idd=158;
    class Controls
    {
        class ReferenceTest: RscText
        {
            type=108;
            idc=1337;
            x= safeZoneX;
            y= safeZoneY + 0.5;
            w= 0.5;
            h= 0.5;
        };
    };

    // Init script, finds the RscDisplayBrowser which was stored in GMyData. Then finds its WebBrowser control and applies it to here
    onLoad = "_disp = _this#0; _ctrl = _this#0 displayCtrl 1337; _ctrl ctrlWebBrowserAction ['SetBrowserReference', GMyData#0 displayCtrl 1337];";
};

To test it in a mission, place a "User Texture" object, and set its texture to

#(rgb,1024,1024,3)ui("RscDisplayBrowser","abc")

Then create the reference display using

createDialog "RscDisplayRef";

Now you have a interactive dialog, who's mouse/keyboard inputs are applied to the control that renders inside the texture.