Arma 3 Scripting

ctrlMapCursor

  • Arma 3 v0.50
  • First in Arma 2 v1.00

Command · Markdown · JSON · original wiki page

Description

Changes the default cursor that appears when interacting with a map control to a custom one. Use an empty string to restore the default cursor.

Important

Before Arma 3, if the specified cursor does not exist the default is used and no error is produced.

In Arma 3, this would result in the following error: "No entry 'bin\config.bin/CfgWrapperUI/Cursors'".

The cursor is the name of a config entry from CfgWrapperUI / Cursors. This command has the following specifics:

Syntax

control ctrlMapCursor [defaultCursor, newCursor]

Parameters:

Returns: Nothing

Examples

Example 1

_map ctrlMapCursor ["Track", "Arrow"];

Example 2

uiNamespace setVariable ["_map", findDisplay 12 displayCtrl 51];
(uiNamespace getVariable "_map") ctrlMapCursor ["Track", "HC_overFriendly"];

Example 3

findDisplay 12 displayCtrl 51 ctrlMapCursor ["Scroll", "Wait"];

Example 4

Cycle through all available cursors over custom map:

0 spawn
{
    disableSerialization;
    _map = findDisplay 46 createDisplay "RscCredits" ctrlCreate ["RscMapControl", -1];
    _map ctrlSetPosition [0,0,1,1];
    _map ctrlCommit 0;
    {
        _map ctrlMapCursor ["", configName _x]; //<-- the actual usage
        hint format ["Current cursor: %1", configName _x];
        sleep 1;
    }
    forEach ("true" configClasses (configFile >> "CfgWrapperUI" >> "Cursors"));
};

See also

setMousePosition · getMousePosition

Community notes

Bull A

When using this command, the cursor will change for the whole display, resulting in visual glitches. Adding the onMouseMoving event handler can help solve this problem:

_control ctrlAddEventHandler ["MouseMoving", {
    params [
        ["_mapCtrl",controlNull, [controlNull]],
        ["_xPos",-1,[0]],
        ["_yPos",-1,[0]],
        ["_mouseIn", false, [true]]
    ];

    if (_mouseIn) then {
    // Mouse is in control area
    _mapCtrl ctrlMapCursor ["", "Track"];
    } else {
    // Mouse is out of control area, goes back to arrow
    _mapCtrl ctrlMapCursor ["", "Arrow"];
    };
}];