Difference between revisions of "ctrlMapCursor"

From Bohemia Interactive Community
Jump to navigation Jump to search
(cursors link)
Line 83: Line 83:
 
[[Category:Command_Group:_GUI_Control|{{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">
 +
<dd class="notedate">Posted on February 8, 2016 - 22:43 (UTC)</dd>
 +
<dt class="note">[[User:Bull A|Bull A]]</dt>
 +
<dd class="note">
 +
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:
 +
<code>
 +
_control addEventHandler ["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"];
 +
  };
 +
}];
 +
</code>
 +
</dd>
 +
</dl>
 +
<!-- DISCONTINUE Notes -->

Revision as of 00:43, 9 February 2016

Template:Command

Notes

Bottom Section

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 addEventHandler ["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"]; }; }];