Jump to content
overlord970

[Help w/Dialog/] Dialog Button help

Recommended Posts

So im just trying to create a menu that uses a combo-list to pick and spawn vehicles, At the moment i use an addaction to open the menu but when i do i only see the RscListbox and the RscPicture, but it doesn't not show me my buttons or the frame. 

 

So my question is what have i done wrong in the code to stop the buttons from showing but other things show.?

 

Dialog.hpp

class Train_Menu_Dialog
{
	idd = 9999;
	movingEnabled = false;
	class controls 
	{
		////////////////////////////////////////////////////////
		// GUI EDITOR OUTPUT START (by Luke, v1.063, #Hefeja)
		////////////////////////////////////////////////////////

		class RscFrame_1800: RscFrame
		{
			idc = 1800;
			x = 12 * GUI_GRID_W + GUI_GRID_X;
			y = 3 * GUI_GRID_H + GUI_GRID_Y;
			w = 16 * GUI_GRID_W;
			h = 16 * GUI_GRID_H;
		};
		class textbox: RscText
		{
			idc = 1000;
			text = "Pick Your Train"; //--- ToDo: Localize;
			x = 17 * GUI_GRID_W + GUI_GRID_X;
			y = 3 * GUI_GRID_H + GUI_GRID_Y;
			w = 6.5 * GUI_GRID_W;
			h = 1.5 * GUI_GRID_H;
		};
		class spawnbut: RscButton
		{
			idc = 1600;
			text = "Spawn"; //--- ToDo: Localize;
			x = 24 * GUI_GRID_W + GUI_GRID_X;
			y = 16.5 * GUI_GRID_H + GUI_GRID_Y;
			w = 4 * GUI_GRID_W;
			h = 2.5 * GUI_GRID_H;
		};
		class Exit: RscButton
		{
			idc = 1601;
			text = "Exit"; //--- ToDo: Localize;
			colorText[] = {0,0,0,0};
			sizeEx = 0.02;
			style = 2;
			x = 12 * GUI_GRID_W + GUI_GRID_X;
			y = 16.5 * GUI_GRID_H + GUI_GRID_Y;
			w = 4 * GUI_GRID_W;
			h = 2.5 * GUI_GRID_H;
			action = "closeDialog 0";
		};
		class list: RscListbox
		{
			idc = 1500;
			text = "Pick Train"; //--- ToDo: Localize;
			x = 0.375;
			y = 0.18;
			w = 0.25;
			h = 0.22;
		};
		class RscPicture_1200: RscPicture
		{	
			idc = 1200;
			text = "#(argb,8,8,3)color(0,1,1,1)";
			x = 0.375;
			y = 0.44;
			w = 0.25;
			h = 0.2;
		};
		////////////////////////////////////////////////////////
		// GUI EDITOR OUTPUT END
		////////////////////////////////////////////////////////
	};
};

Addaction to create dialog with stuff in the list

disableSerialization;

_shopItems = ["Test","TEST1"];

createDialog "Train_Menu_Dialog";

waitUntil {!isNull(findDisplay 9999);};

_ctrl = (findDisplay  9999) displayCtrl 1500;
{
	_ctrl lbAdd _x;
} forEach _shopItems;

Defines.hpp

Spoiler

///////////////////////////////////////////////////////////////////////////
/// Styles
///////////////////////////////////////////////////////////////////////////

// Control types
#define CT_STATIC           0
#define CT_BUTTON           1
#define CT_EDIT             2
#define CT_SLIDER           3
#define CT_COMBO            4
#define CT_LISTBOX          5
#define CT_TOOLBOX          6
#define CT_CHECKBOXES       7
#define CT_PROGRESS         8
#define CT_HTML             9
#define CT_STATIC_SKEW      10
#define CT_ACTIVETEXT       11
#define CT_TREE             12
#define CT_STRUCTURED_TEXT  13
#define CT_CONTEXT_MENU     14
#define CT_CONTROLS_GROUP   15
#define CT_SHORTCUTBUTTON   16
#define CT_XKEYDESC         40
#define CT_XBUTTON          41
#define CT_XLISTBOX         42
#define CT_XSLIDER          43
#define CT_XCOMBO           44
#define CT_ANIMATED_TEXTURE 45
#define CT_OBJECT           80
#define CT_OBJECT_ZOOM      81
#define CT_OBJECT_CONTAINER 82
#define CT_OBJECT_CONT_ANIM 83
#define CT_LINEBREAK        98
#define CT_USER             99
#define CT_MAP              100
#define CT_MAP_MAIN         101
#define CT_LISTNBOX         102
#define CT_CHECKBOX         77

// Static styles
#define ST_POS            0x0F
#define ST_HPOS           0x03
#define ST_VPOS           0x0C
#define ST_LEFT           0x00
#define ST_RIGHT          0x01
#define ST_CENTER         0x02
#define ST_DOWN           0x04
#define ST_UP             0x08
#define ST_VCENTER        0x0C

#define ST_TYPE           0xF0
#define ST_SINGLE         0x00
#define ST_MULTI          0x10
#define ST_TITLE_BAR      0x20
#define ST_PICTURE        0x30
#define ST_FRAME          0x40
#define ST_BACKGROUND     0x50
#define ST_GROUP_BOX      0x60
#define ST_GROUP_BOX2     0x70
#define ST_HUD_BACKGROUND 0x80
#define ST_TILE_PICTURE   0x90
#define ST_WITH_RECT      0xA0
#define ST_LINE           0xB0

#define ST_SHADOW         0x100
#define ST_NO_RECT        0x200
#define ST_KEEP_ASPECT_RATIO  0x800

#define ST_TITLE          ST_TITLE_BAR + ST_CENTER

// Slider styles
#define SL_DIR            0x400
#define SL_VERT           0
#define SL_HORZ           0x400

#define SL_TEXTURES       0x10

// progress bar 
#define ST_VERTICAL       0x01
#define ST_HORIZONTAL     0

// Listbox styles
#define LB_TEXTURES       0x10
#define LB_MULTI          0x20

// Tree styles
#define TR_SHOWROOT       1
#define TR_AUTOCOLLAPSE   2

// MessageBox styles
#define MB_BUTTON_OK      1
#define MB_BUTTON_CANCEL  2
#define MB_BUTTON_USER    4


///////////////////////////////////////////////////////////////////////////
/// Base Classes
///////////////////////////////////////////////////////////////////////////
class RscText
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 0;
	idc = -1;
	colorBackground[] = 
	{
		0,
		0,
		0,
		0
	};
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	text = "Test";
	fixedWidth = 0;
	colorShadow[] = 
	{
		0,
		0,
		0,
		0.5
	};
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	x = 0;
	y = 0;
	h = 0.037;
	w = 0.3;
	style = 0;
	shadow = 1;
	font = "RobotoCondensed";
	SizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	linespacing = 1;
};
class RscStructuredText
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 13;
	idc = -1;
	style = 0;
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	class Attributes
	{
		font = "RobotoCondensed";
		color = "#ffffff";
		colorLink = "#D09B43";
		align = "left";
		shadow = 1;
	};
	x = 0;
	y = 0;
	h = 0.035;
	w = 0.1;
	text = "Test";
	size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	shadow = 1;
};
class RscPicture
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 0;
	idc = -1;
	style = 48;
	colorBackground[] = 
	{
		0,
		0,
		0,
		0
	};
	colorText[] = 
	{
		0,
		1,
		1,
		1
	};
	font = "TahomaB";
	sizeEx = 0;
	lineSpacing = 0;
	text = "";
	fixedWidth = 0;
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	shadow = 0;
	x = 0;
	y = 0;
	w = 0.2;
	h = 0.15;
};
class RscEdit
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 2;
	x = 0;
	y = 0;
	h = 0.04;
	w = 0.2;
	colorBackground[] = 
	{
		0,
		0,
		0,
		0
	};
	colorText[] = 
	{
		0.95,
		0.95,
		0.95,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorSelection[] = 
	{
		"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
		1
	};
	autocomplete = "";
	text = "";
	size = 0.2;
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	style = "0x00 + 0x40";
	font = "RobotoCondensed";
	shadow = 2;
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	canModify = 1;
};
class RscCombo
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 4;
	colorSelect[] = 
	{
		0,
		0,
		0,
		1
	};
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	colorBackground[] = 
	{
		0,
		0,
		0,
		1
	};
	colorScrollbar[] = 
	{
		1,
		0,
		0,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorPicture[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureSelected[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorPictureRight[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureRightSelected[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureRightDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorTextRight[] = 
	{
		1,
		1,
		1,
		1
	};
	colorSelectRight[] = 
	{
		0,
		0,
		0,
		1
	};
	colorSelect2Right[] = 
	{
		0,
		0,
		0,
		1
	};
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	soundSelect[] = 
	{
		"\A3\ui_f\data\sound\RscCombo\soundSelect",
		0.1,
		1
	};
	soundExpand[] = 
	{
		"\A3\ui_f\data\sound\RscCombo\soundExpand",
		0.1,
		1
	};
	soundCollapse[] = 
	{
		"\A3\ui_f\data\sound\RscCombo\soundCollapse",
		0.1,
		1
	};
	maxHistoryDelay = 1;
	class ComboScrollBar
	{
		color[] = 
		{
			1,
			1,
			1,
			1
		};
	};
	colorSelectBackground[] = 
	{
		1,
		1,
		1,
		0.7
	};
	colorActive[] = 
	{
		1,
		0,
		0,
		1
	};
	style = "0x10 + 0x200";
	font = "RobotoCondensed";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	shadow = 0;
	x = 0;
	y = 0;
	w = 0.12;
	h = 0.035;
	arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa";
	arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa";
	wholeHeight = 0.45;
};
class RscListBox
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 5;
	rowHeight = 0;
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorScrollbar[] = 
	{
		1,
		0,
		0,
		0
	};
	colorSelect[] = 
	{
		0,
		0,
		0,
		1
	};
	colorSelect2[] = 
	{
		0,
		0,
		0,
		1
	};
	colorSelectBackground[] = 
	{
		0.95,
		0.95,
		0.95,
		1
	};
	colorSelectBackground2[] = 
	{
		1,
		1,
		1,
		0.5
	};
	colorBackground[] = 
	{
		0,
		0,
		0,
		0.3
	};
	soundSelect[] = 
	{
		"\A3\ui_f\data\sound\RscListbox\soundSelect",
		0.09,
		1
	};
	autoScrollSpeed = -1;
	autoScrollDelay = 5;
	autoScrollRewind = 0;
	arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
	arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
	colorPicture[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureSelected[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorPictureRight[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureRightSelected[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPictureRightDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorTextRight[] = 
	{
		1,
		1,
		1,
		1
	};
	colorSelectRight[] = 
	{
		0,
		0,
		0,
		1
	};
	colorSelect2Right[] = 
	{
		0,
		0,
		0,
		1
	};
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	class ListScrollBar
	{
		color[] = 
		{
			1,
			1,
			1,
			1
		};
		autoScrollEnabled = 1;
	};
	colorShadow[] = 
	{
		0,
		0,
		0,
		0.5
	};
	x = 0;
	y = 0;
	w = 0.3;
	h = 0.3;
	style = 16;
	font = "RobotoCondensed";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	shadow = 0;
	period = 1.2;
	maxHistoryDelay = 1;
};
class RscButton
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 1;
	text = "Test";
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorBackground[] = 
	{
		0,
		0,
		0,
		0.5
	};
	colorBackgroundDisabled[] = 
	{
		0,
		0,
		0,
		0.5
	};
	colorBackgroundActive[] = 
	{
		0,
		0,
		0,
		1
	};
	colorFocused[] = 
	{
		0,
		0,
		0,
		1
	};
	colorShadow[] = 
	{
		0,
		0,
		0,
		0
	};
	colorBorder[] = 
	{
		0,
		0,
		0,
		1
	};
	soundEnter[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundEnter",
		0.09,
		1
	};
	soundPush[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundPush",
		0.09,
		1
	};
	soundClick[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundClick",
		0.09,
		1
	};
	soundEscape[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundEscape",
		0.09,
		1
	};
	idc = -1;
	style = 2;
	x = 0;
	y = 0;
	w = 0.095589;
	h = 0.039216;
	shadow = 2;
	font = "RobotoCondensed";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	url = "";
	offsetX = 0;
	offsetY = 0;
	offsetPressedX = 0;
	offsetPressedY = 0;
	borderSize = 0;
};
class RscShortcutButton
{
	deletable = 0;
	fade = 0;
	type = 16;
	x = 0.1;
	y = 0.1;
	class HitZone
	{
		left = 0;
		top = 0;
		right = 0;
		bottom = 0;
	};
	class ShortcutPos
	{
		left = 0;
		top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
		w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
		h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	};
	class TextPos
	{
		left = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1) * (3/4)";
		top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
		right = 0.005;
		bottom = 0;
	};
	shortcuts[] = 
	{
	};
	textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
	color[] = 
	{
		1,
		1,
		1,
		1
	};
	colorFocused[] = 
	{
		1,
		1,
		1,
		1
	};
	color2[] = 
	{
		0.95,
		0.95,
		0.95,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorBackground[] = 
	{
		"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
		1
	};
	colorBackgroundFocused[] = 
	{
		"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
		1
	};
	colorBackground2[] = 
	{
		1,
		1,
		1,
		1
	};
	soundEnter[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundEnter",
		0.09,
		1
	};
	soundPush[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundPush",
		0.09,
		1
	};
	soundClick[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundClick",
		0.09,
		1
	};
	soundEscape[] = 
	{
		"\A3\ui_f\data\sound\RscButton\soundEscape",
		0.09,
		1
	};
	class Attributes
	{
		font = "RobotoCondensed";
		color = "#E5E5E5";
		align = "left";
		shadow = "true";
	};
	colorSecondary[] = 
	{
		1,
		1,
		1,
		1
	};
	colorFocusedSecondary[] = 
	{
		1,
		1,
		1,
		1
	};
	color2Secondary[] = 
	{
		0.95,
		0.95,
		0.95,
		1
	};
	colorDisabledSecondary[] = 
	{
		1,
		1,
		1,
		0.25
	};
	class AttributesImage
	{
		font = "RobotoCondensed";
		color = "#E5E5E5";
		align = "left";
	};
	idc = -1;
	style = 0;
	default = 0;
	shadow = 1;
	w = 0.183825;
	h = "((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)";
	textSecondary = "";
	sizeExSecondary = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	fontSecondary = "RobotoCondensed";
	animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
	animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
	animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
	animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa";
	animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa";
	animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa";
	periodFocus = 1.2;
	periodOver = 0.8;
	period = 0.4;
	font = "RobotoCondensed";
	size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	text = "";
	url = "";
	action = "";
};
class RscShortcutButtonMain
{
	color[] = 
	{
		1,
		1,
		1,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	class HitZone
	{
		left = 0;
		top = 0;
		right = 0;
		bottom = 0;
	};
	class ShortcutPos
	{
		left = 0.0145;
		top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2";
		w = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2) * (3/4)";
		h = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
	};
	class TextPos
	{
		left = "(((safezoneW / safezoneH) min 1.2) / 32) * 1.5";
		top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 20)*2 - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)) / 2";
		right = 0.005;
		bottom = 0;
	};
	class Attributes
	{
		font = "RobotoCondensed";
		color = "#E5E5E5";
		align = "left";
		shadow = "false";
	};
	class AttributesImage
	{
		font = "RobotoCondensed";
		color = "#E5E5E5";
		align = "false";
	};
	idc = -1;
	style = 0;
	default = 0;
	w = 0.313726;
	h = 0.104575;
	animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
	animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa";
	animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa";
	animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa";
	animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa";
	animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
	period = 0.5;
	font = "RobotoCondensed";
	size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1.2)";
	text = "";
	action = "";
};
class RscFrame
{
	colorBackground[] = 
	{
		1,
		1,
		1,
		1
	};
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	type = 0;
	idc = -1;
	deletable = 0;
	style = 64;
	shadow = 2;
	font = "RobotoCondensed";
	sizeEx = 0.02;
	text = "";
	x = 0;
	y = 0;
	w = 0.3;
	h = 0.3;
};
class RscSlider
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = 3;
	style = 1024;
	color[] = 
	{
		1,
		1,
		1,
		0.8
	};
	colorActive[] = 
	{
		1,
		1,
		1,
		1
	};
	shadow = 0;
	x = 0;
	y = 0;
	w = 0.3;
	h = 0.025;
};
class IGUIBack
{
	colorText[] = 
	{
		0,
		0,
		0,
		0
	};
	colorbackground[] = 
	{
		"(profilenamespace getvariable ['IGUI_BCG_RGB_R',0])",
		"(profilenamespace getvariable ['IGUI_BCG_RGB_G',1])",
		"(profilenamespace getvariable ['IGUI_BCG_RGB_B',1])",
		"(profilenamespace getvariable ['IGUI_BCG_RGB_A',0.8])"
	};
	type = 0;
	idc = 124;
	style = 128;
	text = "";
	font = "RobotoCondensed";
	sizeEx = 0;
	shadow = 0;
	x = 0.1;
	y = 0.1;
	w = 0.1;
	h = 0.1;
};
class RscCheckBox
{
	color[] = 
	{
		1,
		1,
		1,
		0.7
	};
	colorFocused[] = 
	{
		1,
		1,
		1,
		1
	};
	colorHover[] = 
	{
		1,
		1,
		1,
		1
	};
	colorPressed[] = 
	{
		1,
		1,
		1,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.2
	};
	colorBackground[] = 
	{
		0,
		0,
		0,
		0
	};
	colorBackgroundFocused[] = 
	{
		0,
		0,
		0,
		0
	};
	colorBackgroundHover[] = 
	{
		0,
		0,
		0,
		0
	};
	colorBackgroundPressed[] = 
	{
		0,
		0,
		0,
		0
	};
	colorBackgroundDisabled[] = 
	{
		0,
		0,
		0,
		0
	};
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	soundEnter[] = 
	{
		"",
		0.1,
		1
	};
	soundPush[] = 
	{
		"",
		0.1,
		1
	};
	soundClick[] = 
	{
		"",
		0.1,
		1
	};
	soundEscape[] = 
	{
		"",
		0.1,
		1
	};
	idc = -1;
	type = 77;
	deletable = 0;
	style = 0;
	checked = 0;
	x = "0.375 * safezoneW + safezoneX";
	y = "0.36 * safezoneH + safezoneY";
	w = "0.025 * safezoneW";
	h = "0.04 * safezoneH";
	textureChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
	textureUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
	textureFocusedChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
	textureFocusedUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
	textureHoverChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
	textureHoverUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
	texturePressedChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
	texturePressedUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
	textureDisabledChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
	textureDisabledUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
};
class RscTextCheckBox
{
	colorText[] = 
	{
		1,
		0,
		0,
		1
	};
	color[] = 
	{
		0,
		0,
		0,
		0
	};
	colorBackground[] = 
	{
		0,
		0,
		0,
		0
	};
	colorTextSelect[] = 
	{
		0,
		0.8,
		0,
		1
	};
	colorSelectedBg[] = 
	{
		"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
		1
	};
	colorSelect[] = 
	{
		0,
		0,
		0,
		1
	};
	colorTextDisable[] = 
	{
		0.4,
		0.4,
		0.4,
		1
	};
	colorDisable[] = 
	{
		0.4,
		0.4,
		0.4,
		1
	};
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	strings[] = 
	{
		"UNCHECKED"
	};
	checked_strings[] = 
	{
		"CHECKED"
	};
	idc = -1;
	type = 7;
	style = 0;
	x = "0.375 * safezoneW + safezoneX";
	y = "0.36 * safezoneH + safezoneY";
	w = "0.025 * safezoneW";
	h = "0.04 * safezoneH";
	font = "RobotoCondensed";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 0.8)";
	rows = 1;
	columns = 1;
};
class RscButtonMenu
{
	colorBackground[] = 
	{
		0,
		0,
		0,
		0.8
	};
	colorBackgroundFocused[] = 
	{
		1,
		1,
		1,
		1
	};
	colorBackground2[] = 
	{
		0.75,
		0.75,
		0.75,
		1
	};
	color[] = 
	{
		1,
		1,
		1,
		1
	};
	colorFocused[] = 
	{
		0,
		0,
		0,
		1
	};
	color2[] = 
	{
		0,
		0,
		0,
		1
	};
	colorText[] = 
	{
		1,
		1,
		1,
		1
	};
	colorDisabled[] = 
	{
		1,
		1,
		1,
		0.25
	};
	colorSecondary[] = 
	{
		1,
		1,
		1,
		1
	};
	colorFocusedSecondary[] = 
	{
		0,
		0,
		0,
		1
	};
	color2Secondary[] = 
	{
		0,
		0,
		0,
		1
	};
	colorDisabledSecondary[] = 
	{
		1,
		1,
		1,
		0.25
	};
	tooltipColorText[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorBox[] = 
	{
		1,
		1,
		1,
		1
	};
	tooltipColorShade[] = 
	{
		0,
		0,
		0,
		0.65
	};
	class TextPos
	{
		left = "0.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
		top = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) - (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)) / 2";
		right = 0.005;
		bottom = 0;
	};
	class Attributes
	{
		font = "PuristaLight";
		color = "#E5E5E5";
		align = "left";
		shadow = "false";
	};
	class ShortcutPos
	{
		left = "5.25 * (((safezoneW / safezoneH) min 1.2) / 40)";
		top = 0;
		w = "1 * (((safezoneW / safezoneH) min 1.2) / 40)";
		h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
	};
	soundEnter[] = 
	{
		"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",
		0.09,
		1
	};
	soundPush[] = 
	{
		"\A3\ui_f\data\sound\RscButtonMenu\soundPush",
		0.09,
		1
	};
	soundClick[] = 
	{
		"\A3\ui_f\data\sound\RscButtonMenu\soundClick",
		0.09,
		1
	};
	soundEscape[] = 
	{
		"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",
		0.09,
		1
	};
	idc = -1;
	type = 16;
	style = "0x02 + 0xC0";
	default = 0;
	shadow = 0;
	x = 0;
	y = 0;
	w = 0.095589;
	h = 0.039216;
	animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
	animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
	animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
	animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
	animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
	animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
	textSecondary = "";
	sizeExSecondary = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	fontSecondary = "PuristaLight";
	period = 1.2;
	periodFocus = 1.2;
	periodOver = 1.2;
	size = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
	sizeEx = "(((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
};
class RscButtonMenuOK
{
	shortcuts[] = 
	{
		"0x00050000 + 0",
		28,
		57,
		156
	};
	soundPush[] = 
	{
		"\A3\ui_f\data\sound\RscButtonMenuOK\soundPush",
		0.09,
		1
	};
	idc = 1;
	default = 1;
	text = "OK";
};
class RscButtonMenuCancel
{
	shortcuts[] = 
	{
		"0x00050000 + 1"
	};
	idc = 2;
	text = "Cancel";
};
class RscControlsGroup
{
	deletable = 0;
	fade = 0;
	class VScrollbar
	{
		color[] = 
		{
			1,
			1,
			1,
			1
		};
		width = 0.021;
		autoScrollEnabled = 1;
	};
	class HScrollbar
	{
		color[] = 
		{
			1,
			1,
			1,
			1
		};
		height = 0.028;
	};
	class Controls
	{
	};
	type = 15;
	idc = -1;
	x = 0;
	y = 0;
	w = 1;
	h = 1;
	shadow = 0;
	style = 16;
};

 

 

Share this post


Link to post
Share on other sites

Few points to get started on:

1. This would probably be better off being posted in the mission editing/scripting thread. 

2. Put the code samples inside spoiler tags to keep the post easier to read. 

3. At a quick glance (I'm on my phone) your problem might be in the ordering. Try removing the rscPicture to see if your other controls are actually there, then move the picture to the top of the list. If that gets you nowhere then the positioning could be off. The two that you mention as working are just using 0 - 1 for their positions. Whereas the rest are using GUI_GRID with their positions, so pick one and stick with it to make editing and lining everything up easier. 

 

If that doesn't help then I'm outta ideas. Dialogs aren't the easiest things to work with. I always end up learning something new whenever i go to make a new one. 

Share this post


Link to post
Share on other sites

Please put such huge parts of code inside a Spoiler

 

Spoiler

Like this

 

Also this very much looks like you posted in the wrong topic.

 

Edit:  Sorry I completely overlooked @beno_83au's post. It completely disappeared under that huge post. :D

  • Haha 2
  • Confused 1

Share this post


Link to post
Share on other sites
11 minutes ago, Dedmen said:

 

Also this very much looks like you posted in the wrong topic.

 

Moved as per your suggestion :icon_cool:

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

The defines (base classes) must be read by the engine BEFORE the dialogs.

Which means your description.ext should look something like that:
#include "YourDefinesFile.hpp"
#include "YourDialogsFile.hpp"


Assuming you did that at first glance I don't notice anything wrong  with your code.
You should also favor safezone over GUI_GRID and @beno_83au is right the order is important.

  • Like 2

Share this post


Link to post
Share on other sites
10 hours ago, beno_83au said:

Few points to get started on:

1. This would probably be better off being posted in the mission editing/scripting thread. 

2. Put the code samples inside spoiler tags to keep the post easier to read. 

3. At a quick glance (I'm on my phone) your problem might be in the ordering. Try removing the rscPicture to see if your other controls are actually there, then move the picture to the top of the list. If that gets you nowhere then the positioning could be off. The two that you mention as working are just using 0 - 1 for their positions. Whereas the rest are using GUI_GRID with their positions, so pick one and stick with it to make editing and lining everything up easier. 

 

If that doesn't help then I'm outta ideas. Dialogs aren't the easiest things to work with. I always end up learning something new whenever i go to make a new one. 

 

1.Done 2.Done 3. I see what you are saying i will go try moving the rscPicture(EDIT it shows) and ill try doing it with out GUI_GRID as like u said the only difference its that.

1 hour ago, Mr H. said:

The defines (base classes) must be read by the engine BEFORE the dialogs.

Which means your description.ext should look something like that:
#include "YourDefinesFile.hpp"
#include "YourDialogsFile.hpp"


Assuming you did that at first glance I don't notice anything wrong  with your code.
You should also favor safezone over GUI_GRID and @beno_83au is right the order is important.

Done it like that thank you:) and right ok will try safezones 

Share this post


Link to post
Share on other sites

Ok it is working now i just had to redo it using safezones thank you for the help. Right now time to store vehs in variables and put variables in my list i guess. Any one got any quick ideas? im thinking of having this variable _Locomotive_B = "ATS_Trains_A2Locomotive_Blue"; now im struggling trying to figure out how to use this array _shopItems = ["_Locomotive_B","TEST1"];  like how do i tell the code to register which thing i clicked in the combo menu?  Im slowly working my way there, just found onLBDblClick = "systemChat str ['onLBDblClick',_this]; false"; for help with  index potions 

Share this post


Link to post
Share on other sites

Right so this command onLBDblClick = "systemChat str ['onLBDblClick',_this]; false"; will show me index positions of things in the list but this has to be done in the dialog.hpp but my array is in its own sqf file as u can see above, so how do i use the command onlbdblClick so i can use this code

_x = _shopItems find "Locomotive_B"; 
if (_x == 0) then {"Locomotive_Blue" createVehicle spawntrain};

 

Share this post


Link to post
Share on other sites
1 hour ago, overlord970 said:

will show me index positions of things in the list but this has to be done in the dialog.hpp but my array is in its own sqf file as u can see above, so how do i use the command onlbdblClick so i can use this code

You do not have to add the event in the dialog. It can all be handled via your code.

Here is an example of how I would handle something like this.

TAG_fnc_shopDialog = {
	disableSerialization;
	
	params[
		[ "_mode", "INIT" ],
		"_this"
	];
	
	private _shopItems = [
		//Type,                           Location,   Description
		[ "ATS_Trains_A2Locomotive_Blue", spawnTrain, "Locomotive Blue" ], 
		[ "ATS_Trains_A2Locomotive_Red", spawnTrain, "Locomotive Red" ]  //Not sure there is such a thing just an example
	];
	
	switch ( toUpper _mode ) do {
		
		//Mode: INIT create dialog and fill list box
		case "INIT" : {
			//Make sure we can use waitUntil;
			if !( canSuspend ) exitWith {
				//If not then spawn this function
				[] spawn TAG_fnc_shopDialog;
			};
			
			//Create dialog 
			createDialog "Train_Menu_Dialog";

			//Wait until dialog is initilised
			waitUntil {!isNull(findDisplay 9999);};

			//Get listbox control
			private _lb = (findDisplay  9999) displayCtrl 1500;
			
			//Fill list box with shop items
			{
				_x params[ "_type", "", "_description" ];
				
				//If the config of the vehicle has a display name
				_description = if ( isText( configFile >> "CfgVehicles" >> _type >> "displayName" ) ) then {
					//Then get the config value
					getText( configFile >> "CfgVehicles" >> _type >> "displayName" );
				}else{
					//Otherwise use backup name from _shopItems
					_description
				};
				
				//Fill listbox with display names
				_lb lbAdd _description;
			} forEach _shopItems;
			
			//Add event to lb for when an item is Dbl clicked
			_lb ctrlAddEventHandler [ "LBDblClick", {
				//Call dialog function "SELECTED" mode passing _this ( [ _ctrl, _index ] ) 
				[ "SELECTED", _this ] call TAG_fnc_shopDialog
			}];
		};
		
		//Mode: SELECTED spawn selected vehicle at given position
		case "SELECTED" : {
			params[ "_ctrl", "_index" ];
			
			//Get selected indexes _type and _position from _shopItems array
			_shopItems select _index params[ "_type", "_position" ];
			
			//Use BI function so as position can be anything OBJECT, MARKER, LOCATION etc
			_position = _position call BIS_fnc_position;
			
			//Spawn _type at _position
			private _nul = _type createVehicle _position;
		};		
	};	
};

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Hm. I should rethink how I handle dialog scripts ^^. What I'm doing is adding the eventhandlers in the onLoad script/function of the dialog itself so it is something like this:

#define FONT_DISPLAY (findDisplay *IDD*)
#define LB_FONTS (FONT_DISPLAY displayCtrl *IDC*)
waitUntil {!isNull FONT_DISPLAY};
LB_FONTS ctrlAddEventHandler ["KeyDown",{
	params ["_listbox", "_key", "_shift", "_ctrl", "_alt"];
	//code
}];

The advantage of using #define instead of a local variable is that it can be used in the EH of the control. The drawback is that it is less efficient I suppose since you don't store your value in a variable but rather evaluate it each time. @Larrow's solution is also used by BI as far as I can tell. execVM'ing the script is fine too, doesn't have to be a function since it is not that performance relevant. BI does it too.

Share this post


Link to post
Share on other sites
1 hour ago, Larrow said:

You do not have to add the event in the dialog. It can all be handled via your code.

Here is an example of how I would handle something like this.

Oh thank you i appreciate the help and love the commenting:) but ive added this in to my sqf and when i run it via the addaction the GUI will not show, It dose not show any errors,

Do you think its something to do with the addAction ?

Share this post


Link to post
Share on other sites

 

17 hours ago, overlord970 said:

waitUntil {!isNull(findDisplay 9999);};

AddAction doesn't support suspension, which means that you can't use any commands that halt the code execution (sleep, waitUntil, uiSleep...). Instead the code will terminate after the error.

Share this post


Link to post
Share on other sites

@7erra Is there something else i can use? instead of an addaction ? I was thinking of trying to do it on load. but then how to reopen it. @Larrow and im drawing a bit of a blank how would i call this function you have created ?. Or will it not work with the addaction like 7erra said ?.

Share this post


Link to post
Share on other sites
3 minutes ago, 7erra said:

@Larrow's solution is also used by BI as far as I can tell.

Yes BI use similar layouts in some of their scripts, the Arsenal being a good example.

 

4 minutes ago, 7erra said:

it is not that performance relevant

As it is all event based it is really just a state machine and as you say is not really performance relevant, as long as you remember its an event and unscheduled code, it can run quite fast.

 

38 minutes ago, 7erra said:

I should rethink how I handle dialog scripts ^^. What I'm doing is adding the eventhandlers in the onLoad script/function of the dialog itself

There is nothing wrong with that solution. Creating the dialog which then calls its own initialisation function via onLoad is really no different to what I have shown above, if there is no need to actually create the dialog from the code as it is done separately else where.

 

34 minutes ago, 7erra said:

The drawback is that it is less efficient I suppose since you don't store your value in a variable but rather evaluate it each time.

There are plenty of my own scripts that use #define based look ups but depending on what your doing, i.e simple event state like my previous post, there is no need for the look up due to the event itself passing along the control it is attached to. Even if you need to query/change other controls you could use controlParent etc to get your references.

_ctrl ctrlAddEventHandler [ "LBSelChanged", {
	params[ "_ctrl", "_index" ];
	
	_btn = ctrlParent _ctrl displayCtrl SOME_IDC;
	//Or
	_btn = ctrlParentControlsGroup _ctrl controlsGroupCtrl SOME_IDC;
	
}];

Then the only defines you have are idc numbers rather than nested look ups. Then again you can even use the above as definition which comes in particularly useful when dealing with nested controlsGroups.

Spoiler

//UI
#define VSQF_DISPLAY            findDisplay VSQF_IDD
#define UICTRL( IDC )           ( VSQF_DISPLAY displayCtrl IDC ) 
#define UIDISPLAYGRP( IDC )     ( VSQF_DISPLAY displayCtrl IDC ) 
#define UIGRPCTRL( GRP, IDC )   ( GRP controlsGroupCtrl IDC ) 

//Anchors
//cmp ->
#define UICMP( CMP )                        UIDISPLAYGRP( SCRIPTPANELGRP ) controlsGroupCtrl ctrlIDC CMP
#define UICMPACTIVEGRP( CMP )               UICMP( CMP ) controlsGroupCtrl CMP_ACTIVEGRP
#define UICMPACTIVEPIECE( CMP, IDC )        UICMPACTIVEGRP( CMP ) controlsGroupCtrl IDC
#define UICMPANCHORGRP( CMP, IN_OUT )       UICMPACTIVEGRP( CMP ) controlsGroupCtrl IN_OUT
#define UICMPANCHOR( CMP, IN_OUT, IDC )     UICMPANCHORGRP( CMP, IN_OUT ) controlsGroupCtrl IDC

//Anc ->
#define UIANCHORGRP( CTRL )           ctrlParentControlsGroup CTRL
#define UIANCHORACTIVEGRP( CTRL )     ctrlParentControlsGroup ctrlParentControlsGroup CTRL
#define UIANCHORCMP( CTRL )           ctrlParentControlsGroup ctrlParentControlsGroup ctrlParentControlsGroup CTRL

Just an example from a Experimental Visual Scripting interface, the work space is itself a controlsGroup and each component (command) is a set of nested controlGroups and the above allows easy access to retrieve a certain group/ctrl from another nested groups control, either up or down the stack of nested controlGroups. 

 

 

What ever floats your boat I suppose  :icon_biggrin:

 

  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, overlord970 said:

@Larrow and im drawing a bit of a blank how would i call this function you have created ?. Or will it not work with the addaction like 7erra said ?.

How exactly have you added it? As written it should already handle scheduled code (non suspension) by re-spawning the function.

//Make sure we can use waitUntil;
if !( canSuspend ) exitWith {
	//If not then spawn this function
	[] spawn TAG_fnc_shopDialog;
};

 

  • Like 1

Share this post


Link to post
Share on other sites
5 minutes ago, Larrow said:

How exactly have you added it? As written it should already handle scheduled code (non suspension) by re-spawning the function.

 

player addAction["Menu","fn_create_dialog.sqf"]; I put that inside the units init. The sqf holds the above code.

Share this post


Link to post
Share on other sites
1 hour ago, overlord970 said:

Or will it not work with the addaction like 7erra said ?

I was referring to your original code. Larrow's code will work as an addAction. Personally I use the onLoad script for the dialog myself:

class TER_3den_RscFontList
{
    idd = 73090;
    enableSimulation = false;
    onLoad = "_this execVM ""script.sqf"";";
    class controls
    {
    };
};

You now can use this in the addAction:

player addAction ["Open GUI",{createDialog "TER_3den_RscFontList";}];

 

@Larrow

7 minutes ago, Larrow said:

Just an example from a Experimental Visual Scripting interface, the work space is itself a controlsGroup and each component (command) is a set of nested controlGroups and the above allows easy access to retrieve a certain group/ctrl from another nested groups control, either up or down the stack of nested controlGroups

Did you create this? This is one hell of a dialog! 

Share this post


Link to post
Share on other sites

Remove the action from the units init and create a new file called initPlayerLocal.sqf in your mission folder and place the following in it.

Spoiler

//initPlayerLocal.sqf

TAG_fnc_shopDialog = {
	disableSerialization;
	
	params[
		[ "_mode", "INIT" ],
		"_this"
	];
	
	private _shopItems = [
		//Type,                           Location,   Description
		[ "ATS_Trains_A2Locomotive_Blue", spawnTrain, "Locomotive Blue" ], 
		[ "ATS_Trains_A2Locomotive_Red", spawnTrain, "Locomotive Red" ]  //Not sure there is such a thing just an example
	];
	
	switch ( toUpper _mode ) do {
		
		//Mode: INIT create dialog and fill list box
		case "INIT" : {
			//Make sure we can use waitUntil;
			if !( canSuspend ) exitWith {
				//If not then spawn this function
				[] spawn TAG_fnc_shopDialog;
			};
			
			//Create dialog 
			createDialog "Train_Menu_Dialog";

			//Wait until dialog is initilised
			waitUntil {!isNull(findDisplay 9999);};

			//Get listbox control
			private _lb = (findDisplay  9999) displayCtrl 1500;
			
			//Fill list box with shop items
			{
				_x params[ "_type", "", "_description" ];
				
				//If the config of the vehicle has a display name
				_description = if ( isText( configFile >> "CfgVehicles" >> _type >> "displayName" ) ) then {
					//Then get the config value
					getText( configFile >> "CfgVehicles" >> _type >> "displayName" );
				}else{
					//Otherwise use backup name from _shopItems
					_description
				};
				
				//Fill listbox with display names
				_lb lbAdd _description;
			} forEach _shopItems;
			
			//Add event to lb for when an item is Dbl clicked
			_lb ctrlAddEventHandler [ "LBDblClick", {
				//Call dialog function "SELECTED" mode passing _this ( [ _ctrl, _index ] ) 
				[ "SELECTED", _this ] call TAG_fnc_shopDialog
			}];
		};
		
		//Mode: SELECTED spawn selected vehicle at given position
		case "SELECTED" : {
			params[ "_ctrl", "_index" ];
			
			//Get selected indexes _type and _position from _shopItems array
			_shopItems select _index params[ "_type", "_position" ];
			
			//Use BI function so as position can be anything OBJECT, MARKER, LOCATION etc
			_position = _position call BIS_fnc_position;
			
			//Spawn _type at _position
			private _nul = _type createVehicle _position;
		};		
	};	
};

params[ "_player" ];

waitUntil { time > 0 };

_player addAction[ "Menu", { [] spawn TAG_fnc_shopDialog } ];

 

 

  • Like 1

Share this post


Link to post
Share on other sites
6 minutes ago, Larrow said:

Remove the action from the units init and create a new file called initPlayerLocal.sqf in your mission folder and place the following in it.

 

Oh wow thank you, yes this works!:) I might need to try tweak it to work with the spawn button and to get the image form the config for the trains when each one if chosen but this works !!. In case you haven noticed im working on a mission involving ATS trains mod, once i get them spawning on the tracks, i plan to create missions for people to do. 

Share this post


Link to post
Share on other sites
20 minutes ago, 7erra said:

Did you create this? This is one hell of a dialog! 

Yes been a little side project that I keep visiting. Mostly done other than I need to fill out a shit load of data for all of Armas commands and write an extension to allow saving to files within the mission folder.

  • Like 1

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

×