CT WEBBROWSER: Difference between revisions
mNo edit summary |
Lou Montana (talk | contribs) m (Remove RV template usage) |
||
Line 26: | Line 26: | ||
=== ctrlWebBrowserAction === | === ctrlWebBrowserAction === | ||
<pre> | |||
{{RV|type=command | {{RV|type=command | ||
Line 73: | Line 75: | ||
|seealso= [[ctrlURL]] [[menuSetURL]] | |seealso= [[ctrlURL]] [[menuSetURL]] | ||
}} | }} | ||
</pre> | |||
=== Control EventHandler === | |||
This eventhandler can only be added to WebBrowser controls | This eventhandler can only be added to WebBrowser controls | ||
Revision as of 11:03, 13 September 2024
Control Types / MACRO (TYPE VALUE) | |
---|---|
Text/Image/Video |
CT_STATIC (0) | CT_EDIT (2) | CT_HTML (9) | CT_STRUCTURED_TEXT (13) |
Buttons |
CT_BUTTON (1) | CT_ACTIVETEXT (11) | CT_SHORTCUTBUTTON (16) | CT_CHECKBOX (77) | CT_XBUTTON (41) |
Lists |
CT_COMBO (4) | CT_TOOLBOX (6) | CT_CHECKBOXES (7) | CT_TREE (12) | CT_CONTROLS_TABLE (19) | CT_XCOMBO (44) | CT_LISTBOX (5) | CT_LISTNBOX (102) | CT_LISTNBOX_CHECKABLE (104) | CT_XLISTBOX (45) |
3D Objects |
CT_OBJECT (80) | CT_OBJECT_ZOOM (81) | CT_OBJECT_CONTAINER (82) | CT_OBJECT_CONT_ANIM (83) |
Maps |
CT_MAP (100) | CT_MAP_MAIN (101) |
Meta |
CT_SLIDER (3) | CT_XSLIDER (43) | CT_PROGRESS (8) | CT_CONTROLS_GROUP (15) | CT_WEBBROWSER (106) | CT_EXTENSION (107) |
Menu |
CT_CONTEXT_MENU (14) | CT_MENU (46) | CT_MENU_STRIP (47) |
Unknown |
CT_STATIC_SKEW (10) | CT_HITZONES (17) | CT_VEHICLETOGGLES (18) | CT_XKEYDESC (40) | CT_ANIMATED_TEXTURE (45) | CT_LINEBREAK (98) | CT_USER (99) | CT_ITEMSLOT (103) | CT_VEHICLE_DIRECTION (105) |
Introduction
WebBrowser control features an embedded Chromium window.
The URL is subject to allowedHTMLLoadURIs[] whitelisting in CfgCommands config.
ctrlSetURL Can be used to change the URL after creation of the control.
Related commands & functions
Related User Interface Eventhandlers
Alphabetical Order
#define CT_WEBBROWSER 106
Scripting
ctrlWebBrowserAction
{{RV|type=command |game1= arma3dev |version1= 2.20 |gr1= GUI Control |descr= Executes an action on a WebBrowser control. The type of parameters depends on the action type. Possible Actions are: {{{!}} class="wikitable" {{!}}- ! Action ! Parameter ! Result ! Description {{!}}- {{!}} OpenDevConsole {{!}} None {{!}} [[Nothing]] {{!}} Opens a Chrome Developer console for this browser, in a external window. {{!}}- {{!}} ExecJS {{!}} [[String]] {{!}} [[Nothing]] {{!}} Executes Javascript code inside the currently loaded page. {{!}}- {{!}} JSResponse {{!}} [[Boolean]] {{!}} [[Nothing]] {{!}} Respond to a Javascript alert() or confirm(), after triggered by "JSDialog" Eventhandler {{!}}- {{!}} OpenDataAsURL {{!}} [[String]] {{!}} [[Nothing]] {{!}} Displays provided data in browser. This can be used to load HTML from a file and display it in the Browser window. {{!}}} |s1= control [[ctrlWebBrowserAction]] [Action, ...] |p1= control: [[Control]] |p2= Action: [[String]] |r1= [[Nothing]] |x1= <sqf>_control ctrlWebBrowserAction ["OpenDataAsURL", loadFile "example.html"];</sqf> |seealso= [[ctrlURL]] [[menuSetURL]] }}
Control EventHandler
This eventhandler can only be added to WebBrowser controls
JSDialog
- Use on: Control (CT_WEBBROWSER)
- Fired on: Fires when Javascript triggers a alert() or confirm() dialog.
- Returns: Display or control, for controls it also returns the control's config (since 1.56).
If the code does not immediately provide a reply, it should return Nothing.
If the code does not return bool, then the script must call ctrlWebBrowserAction with the "JSDialog" action to reply to the dialog, the WebBrowser will be unresponsive until a reply has been sent.
Default Classes
RscWebBrowser
Baseline RscExtension example
class RscExtension
{
type = CT_WEBBROWSER; // 106
idc = -1;
deletable = 0;
style = 0;
x = 0;
y = 0;
w = 0.3;
h = 0.3;
url= "https://arma3.com";
};