ctrlMapCursor: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) |
Lou Montana (talk | contribs) m (Text replacement - "[] spawn" to "0 spawn") |
||
(16 intermediate revisions by the same user not shown) | |||
Line 20: | Line 20: | ||
}} | }} | ||
The cursor is the name of a config entry from ''CfgWrapperUI / Cursors''. This command has the following specifics: | The cursor is the name of a config entry from ''CfgWrapperUI / Cursors''. This command has the following specifics: | ||
* When used on the Main Map ( | * When used on the Main Map (<sqf inline>findDisplay 12 displayCtrl 51</sqf>), it is possible to override multiple default cursors. For example, while leaving default "Arrow" intact, it is possible to just override "Scroll" with e.g "Wait" (See {{Link|#Example 3}}) | ||
* When used on a custom map, for example user made Mini Map, there is only one single cursor "" for everything, therefore only this cursor can be overridden (see {{ | * When used on a custom map, for example user made Mini Map, there is only one single cursor "" for everything, therefore only this cursor can be overridden (see {{Link|#Example 4}} on how to override it) | ||
Some possible class names (See [[ctrlMapCursor/cursors]] for the whole list): | Some possible class names (See [[ctrlMapCursor/cursors]] for the whole list): | ||
{{Columns|4| | {{Columns|4| | ||
Line 43: | Line 43: | ||
|s1= control [[ctrlMapCursor]] [defaultCursor, newCursor] | |s1= control [[ctrlMapCursor]] [defaultCursor, newCursor] | ||
|p1= control: [[Control]] - | |p1= control: [[Control]] - map control | ||
|p2= defaultCursor: [[String]] - cursor class name, '''case-sensitive''' | |p2= defaultCursor: [[String]] - cursor class name, '''case-sensitive''' | ||
Line 51: | Line 51: | ||
|r1= [[Nothing]] | |r1= [[Nothing]] | ||
|x1= < | |x1= <sqf>_map ctrlMapCursor ["Track", "Arrow"];</sqf> | ||
|x2= < | |x2= <sqf> | ||
( | uiNamespace setVariable ["_map", findDisplay 12 displayCtrl 51]; | ||
(uiNamespace getVariable "_map") ctrlMapCursor ["Track", "HC_overFriendly"]; | |||
</sqf> | |||
|x3= < | |x3= <sqf>findDisplay 12 displayCtrl 51 ctrlMapCursor ["Scroll", "Wait"];</sqf> | ||
|x4= Cycle through all available cursors over custom map: | |x4= Cycle through all available cursors over custom map: | ||
< | <sqf> | ||
{ | 0 spawn | ||
{ | |||
_map = | disableSerialization; | ||
_map | _map = findDisplay 46 createDisplay "RscCredits" ctrlCreate ["RscMapControl", -1]; | ||
_map | _map ctrlSetPosition [0,0,1,1]; | ||
_map ctrlCommit 0; | |||
{ | { | ||
_map | _map ctrlMapCursor ["", configName _x]; //<-- the actual usage | ||
hint format ["Current cursor: %1", configName _x]; | |||
sleep 1; | |||
} | } | ||
forEach ("true" configClasses (configFile >> "CfgWrapperUI" >> "Cursors")); | |||
};</ | }; | ||
</sqf> | |||
|seealso= [[setMousePosition]] [[getMousePosition]] | |seealso= [[setMousePosition]] [[getMousePosition]] | ||
Line 80: | Line 84: | ||
|timestamp= 20160208224300 | |timestamp= 20160208224300 | ||
|text= 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: | |text= 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: | ||
< | <sqf> | ||
_control ctrlAddEventHandler ["MouseMoving", { | |||
["_mapCtrl", | params [ | ||
["_mapCtrl",controlNull, [controlNull]], | |||
["_xPos",-1,[0]], | ["_xPos",-1,[0]], | ||
["_yPos",-1,[0]], | ["_yPos",-1,[0]], | ||
["_mouseIn", | ["_mouseIn", false, [true]] | ||
]; | ]; | ||
if (_mouseIn) then { | |||
// Mouse is in control area | |||
_mapCtrl | _mapCtrl ctrlMapCursor ["", "Track"]; | ||
} | } else { | ||
// Mouse is out of control area, goes back to arrow | |||
_mapCtrl | _mapCtrl ctrlMapCursor ["", "Arrow"]; | ||
}; | }; | ||
}]; | }]; | ||
</ | </sqf> | ||
}} | }} |
Latest revision as of 21:24, 2 September 2024
Description
- 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.
The cursor is the name of a config entry from CfgWrapperUI / Cursors. This command has the following specifics:
- When used on the Main Map (findDisplay 12 displayCtrl 51), it is possible to override multiple default cursors. For example, while leaving default "Arrow" intact, it is possible to just override "Scroll" with e.g "Wait" (See Example 3)
- When used on a custom map, for example user made Mini Map, there is only one single cursor "" for everything, therefore only this cursor can be overridden (see Example 4 on how to override it)
Some possible class names (See ctrlMapCursor/cursors for the whole list):
- Arrow
- Track
- Move
- Scroll
- Rotate
- Track3D
- Move3D
- Rotate3D
- Raise3D
- Wait
- HC_move
- HC_overFriendly
- HC_overEnemy
- HC_overMission
- HC_unsel
- Groups:
- GUI Control - Map
Syntax
- Syntax:
- control ctrlMapCursor [defaultCursor, newCursor]
- Parameters:
- control: Control - map control
- defaultCursor: String - cursor class name, case-sensitive
- newCursor: String - cursor class name, case-sensitive
- Return Value:
- 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:
- 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")); };
Additional Information
- See also:
- setMousePosition getMousePosition
Notes
-
Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
- Posted on Feb 08, 2016 - 22:43 (UTC)
-
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"]; }; }];