Jump to content

Recommended Posts

I'm working on a dialog for a game mode (and potentially later a mod, we'll see). It's essentially a tablet UI covering a bunch of functions. Support requests, section orders/planning and ISTAR (intelligence gathering). I appreciate the work needed to get this done, it's a long term project. I also know there's cTab, which is a great mod but I'm looking to make something a bit more bespoke to my unit.

 

Anyway, the dialog issue is that I can't really achieve what I want in terms of layering. I've read that the order dialog controls are defined in is the order they are layered (z-index essentially). That's great, except the map controls seem to ignore this. With the layering I have, if I put the map to ControlsBackground it can't be interacted with, but if I take it out of there into Controls, it sits on top of everything, regardless of order. The reason the map can't be interacted with is there is a controls group covering the screen area to hide any content that strays outside of the tablet image.

 

So, does anyone know of any better way to avoid controls appearing outside a defined area, or does anyone know how to force an element to be behind another?

 

What I intended...

The "overlapping"...

Overlapping with the context menu focused (clicking on it brings it to the front)...

Share this post


Link to post
Share on other sites
5 hours ago, crazy538 said:

The reason the map can't be interacted with is there is a controls group covering the screen area to hide any content that strays outside of the tablet image.

About the only thing I can suggest is

  • to add the events onMouseZChanged onMouseButtonDown/Up to your controlsGroup and handle the map animations yourself with ctrlMapAnim# commands.
  • or scrap the controlsGroup and just make sure none of your controls can ever be outside the desired display area. I presume the little menu you show is initiated via a click in the controlsGroup and ctrlSetPosition to the mouseClick position? Instead initiate it from a onMouseDown on the map, then make sure its position + width is not greater than map position + width, if it is remove its width from its position, and do the same for height, so its always inside the map.

Share this post


Link to post
Share on other sites

Yea, mouseDblClick but the position on the controlsGroup is way off.

I never thought of setting the width and height to keep it in the border, I'll give that a go. Thanks Larrow, I'll let you know if it works.

Sent from my HTC One_M8 using Tapatalk

Share this post


Link to post
Share on other sites

I couldn't find anything about resizing elements via scripts. I think you need to use a global variable in the sizing to effect it live.

Anyway, I scaled the UI up a bit and its masked the problem for now. Not the result I was hoping for but it has the same effect ;)

Sent from my HTC One_M8 using Tapatalk

Share this post


Link to post
Share on other sites
13 hours ago, crazy538 said:

I couldn't find anything about resizing elements via scripts. I think you need to use a global variable in the sizing to effect it live.

No, no global var needed, I gave you the name of the command in my last post. ctrlSetPosition.

 

Something like..



//display
//onLoad = "[ 'INIT', _this ] call CRAZY_fnc_UI";


//CRAZY_fnc_UI

disableSerialization;

params[ "_fnc", "_this" ];

switch ( toUpper _fnc ) do {
	
	case "INIT" : {
		params[ "_display" ];
		
		_myControlsGroup = _display displayCtrl IDC_of_ctrlGrp;
		_myControlsGroup ctrlAddEventHandler [ "MouseButtonDblClick", {
			[ "SHOW_MENU", _this ] call CRAZY_fnc_UI;
		}];
		
		//Hide menu
		_myMenu = _myControlsGroup controlsGroupCtrl IDC_of_popUpMenu;
		_myMenu ctrlSetFade 1;
		_myMenu ctrlCommit 0;
		
	};
	
	case "SHOW_MENU" : {
		params[ "_ctrlGrp", "_button", "_mouseX", "_mouseY", "_shft", "_ctr", "_alt" ];
		
		_myMenu = _ctrlGrp controlsGroupCtrl IDC_of_popUpMenu;
		
		//Get ctrl group position and size
		( ctrlPosition _ctrlGrp ) params[ "_grpX", "_grpY", "_grpW", "_grpH" ];
		//Get menu size
		( ctrlPosition _myMenu ) params[ "", "", "_menuW", "_menuH" ];
		
		//if the menu size falls out side the control grp width
		if ( _mouseX + _menuW > _grpW ) then {
			//Remove the excess from the postion
			_mouseX = _mouseX - (( _mouseX + _menuW ) - _grpW );
		};
		
		//Same for height
		if ( _mouseY + _menuH > _grpH ) then {
			_mouseY = _mouseY - (( _mouseY + _menuH ) - _grpH );
		};
		
		//Set position
		_myMenu ctrlSetPosition[ _mouseX, _mouseY, _menuW, _menuH ];
		//Unhide menu
		_myMenu ctrlSetFade 0;
		//init changes
		_myMenu ctrlCommit 0;
		
	};
	
};

 

Share this post


Link to post
Share on other sites

Ah yea, sorry I forgot what you wrote :P That will definitely work then, I've got them all the sizes and positions in defines so I can easily check.

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

×