Jump to content

Recommended Posts

Hello, I am trying to make a TreeView dialog that allows me to select units (in fact what I would like is exactly the same treeView of the Eden Editor) and I have been making filters and using the configClasses but I just did not like the result. Anyone know how I could get something like that?

I'm using this to filter, but it doesn't seem to be a good approach I think, because some strange units still appear

 

fn_load.sqf

_cntrlTree = (findDisplay 1500) displayCtrl 0;

_ManList = ("configName _x isKindOf 'Man' AND configName _x isKindOf 'SoldierWB' AND (getText (_x >> 'faction')=='BLU_F') AND (getText(_x >> 'editorSubcategory')=='EdSubcat_Personnel')" configClasses (configFile / "CfgVehicles"));

{
    _text = getText(configFile >> "CfgVehicles" >> configName _x >> "displayName");
    _text0 = getText(configFile >> "CfgVehicles" >> configName _x >> "editorSubcategory");
    _cntrlTree tvAdd [[],_text];
    _cntrlTree tvSetTooltip [[_forEachIndex], configName _x];
} forEach _ManList;

_cntrlTree tvSort [[], false];

The following is in case someone serves as I am doing the treeVIew, although to solve the problem it may not be necessary.

Quote

MainGUI.hpp


class A3UDMG_main
{

	idd=1500;
	movingEnable = false;
	enableSimulation = true;
	fadein=0;
	duration = 1e+011;
	fadeout=0;
	onLoad = "params ['_displayorcontrol']; [_displayorcontrol] spawn A3U_DMG_ui_fnc_load;";

	controlsBackground[]={};
	objects[]={};
	class Controls
	{
		class RSC_Tree_0: RscTree
		{
			idc = 0;
			text = "" //--- ToDo: Localize;
			x = 0;
			y = 0;
			w = 0.4;
			h = 1;
			colorBackground[] = {0,0,0,0.5};
			onTreeSelChanged = "params ['_control', '_selectionPath']; [_control,_selectionPath] spawn A3U_DMG_ui_fnc_Change;";
		}
		class RscPicture_130: RscPicture
		{
			idc = 130;
			text = "";
			x = 0.5;
			y = 0;
			w = 0.15 * safezoneW;
			h = 0.15 * safezoneH;
		};
	};
};

fn_Change.sqf


params ["_control", "_selectionPath"];	

_display = ctrlParent _control;

_className = _control tvTooltip _selectionPath;
_imagePath = getText (configfile >> "CfgVehicles" >> _className >> "editorPreview");
_display displayCtrl (130) ctrlSetText _imagePath;




Thanks for the help.

Share this post


Link to post
Share on other sites
17 hours ago, Piloto_Spyke said:

some strange units still appear

Add...

getNumber( _x >> "scope" ) == 2

...to your filter. Only classes designed to be spawned.

  • Like 2

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

×