Jump to content
Sign in to follow this  
zodd

Main map - ctrlSetEventHandler and MouseMoving - not returning to default handling

Recommended Posts

Gday all,

I am overlaying images onto the main map using the following (extracts of) code:

_layer cutRsc [ZOD_MAP_TOOL_PROTRACTOR_FILE_NAME,"PLAIN", 0, true];
openMap true;

_defaultMainMapCtrl = (findDisplay 12) displayCtrl 51;

_defaultMainMapCtrl ctrlSetEventHandler ["MouseMoving","[_this select 1,_this select 2] call ZOD_MAPTOOL_MOUSE_MOVE_FNC"];

Mouse move function:

_toolsActive = player getVariable ["ZOD_MAP_TOOL_DISPLAY", true];
_return = false;
if (_toolsActive) then 
{
  _mouseX = _this select 0;
  _mouseY = _this select 1;
  player setVariable ["ZOD_NAV_MAP_MOUSE_X", _mouseX];
  player setVariable ["ZOD_NAV_MAP_MOUSE_Y", _mouseY];
  hint format ["%1, %2", _mouseX, _mouseY];
};
_return

(The above code sets the variables to draw 'string' to)

Functionality:

That all works fine however there is one tiny problem - It is overriding the BIS default mouse moving event handler. The wiki (below) states: The provided function should return true/false indicating that the event has handled this event fully or not and whether the engine should execute it's default code or not afterwards.

http://community.bistudio.com/wiki/ctrlSetEventHandler

The issue I have is this is not working - Normally on lower difficulty, the mouse cursor will display the grid coords and ASL height. As soon as the ctrlSetEventHandler is run on the map it prevents the coords etc being shown, regardless of the function returning true or false. Not REALLY a major concern (especially as the mod I am making is to do with Nav so people should be able to read grid refs if they are using it...) however it is concerning that it isnt working as expected.

Ideally I would prefer an ctrlAddEventHandler because by setting it, it will make it non compatible with any other mod that sets mouse moving EH on the main map.

Alternatively

1. Is there any way to remove the event handler that has been set? (Display EH - easy to remove, Control EH doesnt appear to let you remove it once you have set it... maybe some hidden resetEH command?)

2. Is there any other way to get the x/y coords of the mouse on the main map screen? DISPLAY event handlers are fine (and dont remove the map functionality) however the MouseMoving EH for DISPLAY returns the mouse speed, not position...

Feedback much appreciated!

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×