Difference between revisions of "ctrlMapCursor"

From Bohemia Interactive Community
Jump to navigation Jump to search
m
m (Text replacement - " <!-- (DIS)?CONTINUE Notes -->" to "")
 
(40 intermediate revisions by 6 users not shown)
Line 1: Line 1:
{{Command|= Comments
+
{{RV|type=command
____________________________________________________________________________________________
 
  
| arma2 |= Game name
+
| arma2
  
|1.00|= Game version
+
|1.00
____________________________________________________________________________________________
 
  
| 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. If the specified cursor does not exist, the default is used and no error is produced. The cursor is the name of a config entry from ''CfgWrapperUI / Cursors''. Some possible class names:
+
|gr1= GUI Control - Map
<br><br>
+
 
 +
| 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. If the specified cursor does not exist, the default is used and no error is produced. ( NOT in case of Arma 3. Using an empty string will result in an 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:
 +
* When used on 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 lets say "Wait" (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 (for the whole list see [[ctrlMapCursor/cursors]]):
 
* Arrow
 
* Arrow
 
* Track
 
* Track
Line 24: Line 26:
 
* HC_overMission
 
* HC_overMission
 
* HC_unsel
 
* HC_unsel
<br>
+
'''NOTE1''': Cursor names are '''case sensitive'''.
'''NOTE''': Cursor name is '''case sensitive'''.|= Description
 
____________________________________________________________________________________________
 
  
| control '''ctrlMapCursor''' [defaultCursor, newCursor] |= Syntax
+
| control '''ctrlMapCursor''' [defaultCursor, newCursor]
  
|p1= control: [[Control]] - Map control |= PARAMETER1
+
|p1= control: [[Control]] - Map control
  
|p2= defaultCursor: [[String]] - Cursor class name |= PARAMETER2
+
|p2= defaultCursor: [[String]] - Cursor class name
  
|p3= newCursor: [[String]] - Cursor class name |= PARAMETER3
+
|p3= newCursor: [[String]] - Cursor class name
  
| [[Nothing]] |= RETURNVALUE
+
| [[Nothing]]
  
 
+
|x1= <code>_map [[ctrlMapCursor]] ["Track", "Arrow"];</code>
|x1= <code>_map [[ctrlMapCursor]] ["Track", "Arrow"];</code>|= EXAMPLE1
 
  
 
|x2= <code>[[uiNamespace]] [[setVariable]] ["_map",[[findDisplay]] 12 [[displayCtrl]] 51];
 
|x2= <code>[[uiNamespace]] [[setVariable]] ["_map",[[findDisplay]] 12 [[displayCtrl]] 51];
([[uiNamespace]] [[getVariable]] "_map") [[ctrlMapCursor]] ["Track","HC_overFriendly"];</code>|= EXAMPLE2
+
([[uiNamespace]] [[getVariable]] "_map") [[ctrlMapCursor]] ["Track","HC_overFriendly"];</code>
 
 
|x3= <code>[[findDisplay]] 12 [[displayCtrl]] 51 [[ctrlMapCursor]] ["Scroll", "Wait"];</code>|= EXAMPLE3
 
  
____________________________________________________________________________________________
+
|x3= <code>[[findDisplay]] 12 [[displayCtrl]] 51 [[ctrlMapCursor]] ["Scroll", "Wait"];</code>
  
| [[setMousePosition]] |= SEEALSO
+
|x4= Cycle through all available cursors over custom map:<code>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"));
 +
};</code>
  
| |= MPBEHAVIOUR
+
|seealso= [[setMousePosition]], [[getMousePosition]]
____________________________________________________________________________________________
 
 
}}
 
}}
  
<h3 style='display:none'>Notes</h3>
 
<dl class='command_description'>
 
<!-- Note Section BEGIN -->
 
 
<!-- Note Section END -->
 
</dl>
 
  
<h3 style='display:none'>Bottom Section</h3>
+
{{GameCategory|arma2|Scripting Commands}}
[[Category:ArmA 2: New Scripting Commands List|{{uc:{{PAGENAME}}}}]]
+
{{GameCategory|arma3|Scripting Commands}}
[[Category:Scripting Commands ArmA2|{{uc:{{PAGENAME}}}}]]
+
{{GameCategory|tkoh|Scripting Commands}}
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
 
[[Category:Command_Group:_GUI_Control|{{uc:{{PAGENAME}}}}]]
 
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
 
[[Category:Scripting Commands|{{uc:{{PAGENAME}}}}]]
  
<!-- CONTINUE Notes -->
 
 
<dl class="command_description">
 
<dl class="command_description">
<dd class="notedate">Posted on August 14, 2015 - 11:01 (UTC)</dd>
+
<dt></dt>
 +
<dd class="notedate">Posted on February 8, 2016 - 22:43 (UTC)</dd>
 
<dt class="note">[[User:Bull A|Bull A]]</dt>
 
<dt class="note">[[User:Bull A|Bull A]]</dt>
 
<dd class="note">
 
<dd class="note">
control argument must be (findDisplay 12 displayCtrl 51). Other controls, even if extending from the RscMapControl class will not be affected by this command.<br/><br/>
+
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:
Example:<br/>
+
<code>_control [[ctrlAddEventHandler]] ["MouseMoving",{
<code>_map = uiNamespace getVariable ["CustomMapDisplayIdd",_displayNull];
+
  _this [[params]] [
_map [[ctrlMapCursor]] ["Track", "Track"];</code>
+
      ["_mapCtrl",[[controlNull]],[[[controlNull]]]],
Result: No change
+
      ["_xPos",-1,[0]],
<br/><br/>
+
      ["_yPos",-1,[0]],
Please see the [http://feedback.arma3.com/view.php?id=25141 link Feedback Ticket] for more information.
+
      ["_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"];
 +
  };
 +
}];
 +
</code>
 
</dd>
 
</dd>
 
</dl>
 
</dl>
<!-- DISCONTINUE Notes -->
 

Latest revision as of 01:50, 6 April 2021

Hover & click on the images for descriptions

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. If the specified cursor does not exist, the default is used and no error is produced. ( NOT in case of Arma 3. Using an empty string will result in an 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:
  • When used on 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 lets say "Wait" (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 (for the whole list see ctrlMapCursor/cursors):
  • Arrow
  • Track
  • Move
  • Scroll
  • Rotate
  • Track3D
  • Move3D
  • Rotate3D
  • Raise3D
  • Wait
  • HC_move
  • HC_overFriendly
  • HC_overEnemy
  • HC_overMission
  • HC_unsel
NOTE1: Cursor names are case sensitive.

Syntax

Syntax:
control ctrlMapCursor [defaultCursor, newCursor]
Parameters:
control: Control - Map control
defaultCursor: String - Cursor class name
newCursor: String - Cursor class name
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:
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")); };

Additional Information

See also:
setMousePositiongetMousePosition
Groups:
GUI Control - Map

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 February 8, 2016 - 22:43 (UTC)
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",{ _this 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"]; }; }];