DialogControls-Menu: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (→‎CT_CONTEXT_MENU=14: rpt error when created)
m (→‎CT_MENU_STRIP=47: added another example)
Line 218: Line 218:
'''TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here. '''
'''TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here. '''


[[File:a3 ct menu strip.jpg|thumb|3den menu strip expanded to the second level]]
[[File:a3 ct menu strip.jpg|thumb|[[Eden Editor]] menu strip expanded to the second level]]


The top bar of 3den Editor containing entries like "Scenario", "Edit", "View", etc. In contrary to the other menu types it is fully functional on custom displays.
The top bar of [[Eden Editor]] containing entries like "Scenario", "Edit", "View", etc. In contrary to the other menu types it is fully functional on custom displays.


{| border="1" align="left" cellpadding="3" cellspacing="0" |
{| border="1" align="left" cellpadding="3" cellspacing="0" |
Line 253: Line 253:
|  
|  
|}<br clear="all">
|}<br clear="all">
===Custom Items Class===
{| border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
|-
! bgcolor="#ddddff" | Name
! bgcolor="#ddddff" | Type
! bgcolor="#ddddff" | Remark
|-
|text || [[String]] || Name of the entry
|-
||action|| [[String]] || Code executed when entry is clicked
|-
||opensNewWindow|| [[Number]] || If 1, "..." is added to the text property, indicating that a new display will be opened
|-
||picture|| [[String]] || Path to picture shown left of the text property
|-
||weblink|| [[String]] || URL to a web page. Page will be opened in the default web browser
|-
||shortCuts|| [[Array]] || List of shortcuts which is shown right of the text property (Shortcut itself seems to have no function, needs further investigation)
|}<br clear="all">
{{Informative|Above attributes will only work for entries of the second level.}}


* '''Example:'''
* '''Example:'''
<code><nowiki>
<syntaxhighlight lang="cpp">class MenuStrip
class MenuStrip
{
{
idc=120;
idc=120;
Line 343: Line 365:
};
};
};
};
};
};</syntaxhighlight>
</nowiki></code>
 
* '''Example:'''
<syntaxhighlight lang="cpp">class RscMenuStrip
{
idd = -1;
movingEnable = true;
enableSimulation = true;
onLoad = "";
onUnload = "";
class Controls
{
class MenuStrip: ctrlMenuStrip
{
idc = 1000;
x = safeZoneX;
y = (safeZoneY + (safezoneH * 0.132));
w =  safezoneW;
h = (safezoneH  * 0.03);
class Items
{
items[] = //First Level Entries, when editing an existing menu strip, one can use the += operator to add new entries without overwriting the old ones
{
"Menu1",
"Menu2"
};
class Menu1
{
text = "Menu 1";
items[] = //Second Level Entries
{
"WebLink"
};
};
class Menu2
{
text = "Menu 2";
items[] = //Second Level Entries
{
"SayHello",
"PlayMusic"
};
};
class WebLink
{
text = "Go to Arma 3 Webpage"; //Display name of menu entry
picture = "\A3\Ui_f\data\Logos\arma3_white_ca.paa"; //Picture shown in front of text
            weblink = "https://arma3.com/"; //Opens a web page in default webbrowser
opensNewWindow = 1; //Adds ... after text, indicating that this menu entry will open a new display
};
class SayHello
{
text = "Say Hello";
action = "systemChat 'Hello World!'"; //Code executed when entry is clicked
};
class PlayMusic
{
text = "Play Music";
picture = "\a3\Modules_F_Curator\Data\portraitMusic_ca.paa";
action = "playMusic 'Track15_MainTheme'";
};
class Default //Default entries, otherwise error is shown upon creation of the display (Needs further investigation)
{
text = "Default";
};
};
};
};
};</syntaxhighlight>


[[Category: Dialogs]]
[[Category: Dialogs]]

Revision as of 16:37, 26 January 2020

Template:Stub

CT_CONTEXT_MENU=14

TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.

Context menu in the UAV terminal display

Control with unknown application. It is used for the waypoint editing in the UAV terminal but is not reproducable in other displays. When creating it either by config or ctrlCreate command the following rpt error is logged:

Do not create it this way

Properties
Name Type Remark
colorBorder color array
colorSeperator color array
colorSelectBackground color array
colorChecked color array


  • Example:

class RscDisplayUavTerminalWaypointMenu { idc=108; type=CT_CONTEXT_MENU; font="RobotoCondensed"; sizeEx="0.028*SafezoneH"; style=0; colorBackground[]={0,0,0,0.5}; colorBorder[]={0,0,0,0}; colorSeparator[]={0.94999999,0.94999999,0.94999999,1}; colorSelectBackground[]={1,1,1,0.30000001}; colorChecked[]= { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])", "(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])" }; colorEnabled[]={1,1,1,1}; colorDisabled[]={1,1,1,0.25}; x=0; y=0; w=0; h=0; };

CT_MENU=46

TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.

3den right click menu

3den context menu which is opened with right click. Same problems as CT_CONTEXT_MENU. When created as part of class controls it is visible and functional until clicked on/clicked on another part of the display and thereupon deleted. When listed as an independed class similar to controls and controlsBackground, like in 3den, it is not created at all. Also, the menu commands (menuAdd, menuSize, etc) don't seem to work on it.

Properties
Name Type Remark
items class
arrow String Path to .paa file or procedural texture
rowHeight Number
itemSpacingW Number
itemSpacingH Number
pictureCheckboxEnabled Path to .paa file or procedural texture
pictureCheckboxDisabled Path to .paa file or procedural texture
pictureRadioEnabled Path to .paa file or procedural texture
pictureRadioDisabled Path to .paa file or procedural texture


class Items

First entry is an items[] array listing all entry classes. Afterwards come the entry classes themselves. There has to be a Default class. See Eden Editor: Entity Context Menu for more information.

Properties
Name Type Remark
Entry class Name can be anything


class Entry (Anything)

Properties
Name Type Remark
text string
action string Has to contain valid sqf command(s)
conditionShow string Simple Expression. Refer to Eden Editor: Entity Context Menu



  • Example:

class ContextMenu { idc=1100; type=CT_MENU; shadow=1; sizeEx="4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5"; font="RobotoCondensedLight"; colorBorder[]={0,0,0,0}; colorBackground[]={0.1,0.1,0.1,1}; colorText[]={1,1,1,1}; colorSelect[]={0,0,0,1}; colorSelectBackground[]= { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])", 1 }; colorDisabled[]={1,1,1,0.25}; colorPicture[]={1,1,1,1}; colorPictureSelect[]={0,0,0,1}; colorPictureDisabled[]={1,1,1,0.5}; arrow="\a3\3DEN\Data\Controls\ctrlMenu\arrow_ca.paa"; rowHeight=0; itemSpacingW=0.0099999998; itemSpacingH=0.0099999998; pictureCheckboxEnabled="\a3\3DEN\Data\Controls\CtrlMenu\pictureCheckboxEnabled_ca.paa"; pictureCheckboxDisabled="#(argb,8,8,3)color(0,0,0,0)"; pictureRadioEnabled="\a3\3DEN\Data\Controls\CtrlMenu\pictureRadioEnabled_ca.paa"; pictureRadioDisabled="#(argb,8,8,3)color(0,0,0,0)"; class Items { items[]= { "entry1", "entry2" }; class Separator { value=0; }; class entry1 { text = "My first entry"; action = "systemchat ""Selected first entry."";"; conditionShow="hoverObject"; }; class entry2 { text = "My second entry"; action = "systemchat ""Selected second entry."";"; conditionShow="1"; }; class Default { text=""; data="Empty"; enable=0; }; }; };

CT_MENU_STRIP=47

TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.

Eden Editor menu strip expanded to the second level

The top bar of Eden Editor containing entries like "Scenario", "Edit", "View", etc. In contrary to the other menu types it is fully functional on custom displays.

Properties
Name Type Remark
Items class Same as CT_MENU
colorStripBackground color array
colorStripText color array
colorStripSelect color array
colorStripSelectBackground color array
colorStripDisabled color array


Custom Items Class

Properties
Name Type Remark
text String Name of the entry
action String Code executed when entry is clicked
opensNewWindow Number If 1, "..." is added to the text property, indicating that a new display will be opened
picture String Path to picture shown left of the text property
weblink String URL to a web page. Page will be opened in the default web browser
shortCuts Array List of shortcuts which is shown right of the text property (Shortcut itself seems to have no function, needs further investigation)


Above attributes will only work for entries of the second level.
  • Example:
class MenuStrip
{
	idc=120;
	type=CT_MENU_STRIP;
	colorStripBackground[]={0,0,0,1};
	colorStripText[]={1,1,1,1};
	colorStripSelect[]={0,0,0,1};
	colorStripSelectBackground[]=
	{
		"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
		1
	};
	colorStripDisabled[]={1,1,1,0.25};
	x="safezoneX";
	y="safezoneY";
	w="safezoneW - 	5 * (pixelW * pixelGrid * 	0.50)";
	h="5 * (pixelH * pixelGrid * 	0.50)";
	colorStripBackground[]={0,0,0,0};
	colorBackground[]={0.1,0.1,0.1,1};
	font="RobotoCondensedLight";
	colorBorder[]={0,0,0,0};
	colorText[]={1,1,1,1};
	colorSelect[]={0,0,0,1};
	colorSelectBackground[]=
	{
		"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
		"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
		1
	};
	colorDisabled[]={1,1,1,0.25};
	colorPicture[]={1,1,1,1};
	colorPictureSelect[]={0,0,0,1};
	colorPictureDisabled[]={1,1,1,0.5};
	arrow="\a3\3DEN\Data\Controls\ctrlMenu\arrow_ca.paa";
	rowHeight=0;
	itemSpacingW=0.0099999998;
	itemSpacingH=0.0099999998;
	pictureCheckboxEnabled="\a3\3DEN\Data\Controls\CtrlMenu\pictureCheckboxEnabled_ca.paa";
	pictureCheckboxDisabled="#(argb,8,8,3)color(0,0,0,0)";
	pictureRadioEnabled="\a3\3DEN\Data\Controls\CtrlMenu\pictureRadioEnabled_ca.paa";
	pictureRadioDisabled="#(argb,8,8,3)color(0,0,0,0)";
	class Items
	{
		items[]=
		{
			"entry1",
			"entry2",
			"entry3",
		};
		class entry1
		{
			text="First Entry";
			items[]=
			{
				"sub1_1",
				"sub1_2"
			};
		};
		class sub1_1
		{
			text="First Sub Entry";
			action= systemchat ""Sub entry one."";";
		};
		class sub1_2
		{
			text="Second Sub Entry";
		};
		class entry2
		{
			text="Entry 2, no sub menu";
			action="systemchat ""Entry 2."";";
		};
		class entry3
		{
			text="Fancy entry 3";
			action ="systemchat ""Entry 3."";";
			data="CustomData";
			shortcuts[]= 
			{
				"512 + 0x31" // STRG+N
			};
			picture="\a3\3DEN\Data\Displays\Display3DEN\ToolBar\new_ca.paa";
		};
	};
};
  • Example:
class RscMenuStrip
{
	idd = -1;
	movingEnable = true;
	enableSimulation = true;
	onLoad = "";
	onUnload = "";
	class Controls
	{
		class MenuStrip: ctrlMenuStrip
		{
			idc = 1000;
			x = safeZoneX;
			y = (safeZoneY + (safezoneH * 0.132));
			w =  safezoneW;
			h = (safezoneH  * 0.03);
			class Items
			{
				items[] = //First Level Entries, when editing an existing menu strip, one can use the += operator to add new entries without overwriting the old ones
				{
					"Menu1",
					"Menu2"
				};
	 			class Menu1
				{
					text = "Menu 1";
					items[] = //Second Level Entries
					{
						"WebLink"
					};
				};
				class Menu2
				{
					text = "Menu 2";
					items[] = //Second Level Entries
					{
						"SayHello",
						"PlayMusic"
					};
				};
				class WebLink
				{
					text = "Go to Arma 3 Webpage"; //Display name of menu entry
					picture = "\A3\Ui_f\data\Logos\arma3_white_ca.paa"; //Picture shown in front of text
            		weblink = "https://arma3.com/"; //Opens a web page in default webbrowser
					opensNewWindow = 1; //Adds ... after text, indicating that this menu entry will open a new display
				};
				class SayHello
				{
					text = "Say Hello";
					action = "systemChat 'Hello World!'"; //Code executed when entry is clicked
				};
				class PlayMusic
				{
					text = "Play Music";
					picture = "\a3\Modules_F_Curator\Data\portraitMusic_ca.paa";
					action = "playMusic 'Track15_MainTheme'";
				};
				class Default //Default entries, otherwise error is shown upon creation of the display (Needs further investigation)
				{
					text = "Default";
				};
			};
		};
	};
};