CT CONTROLS GROUP: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(page overhaul)
Tag: Removed redirect
m (Text replacement - " ( *class [a-zA-Z0-9_]+): *([a-zA-Z0-9_]+ *) " to " $1 : $2 ")
 
(16 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{CT|intro
{{CT|intro
|macro = CT_CONTROLS_GROUP
|macro = CT_CONTROLS_GROUP
|value = 15
|value = 15
|description = Container control for other controls. The child controls have to be defined in the '''controls''' subclass. The child controls' positions are calculated relatively to the control group, so x = 0 and y = 0 moves the child control to the top left corner of the controls group. If the position or height/width of any child controls cause any part of the child control to fall outside the dimensions of the controls group then scrollbars will become visible. This allows for the creation of scrollable text controls for example. Control groups are not visible by themselves, therefore most of the common attributes, eg. colorBackground, do not apply.
|description = Container control for other controls. The child controls have to be defined in the '''controls''' subclass. The child controls' positions are calculated relatively to the control group, so {{hl|x {{=}} 0;}} and {{hl|y {{=}} 0;}} moves the child control to the top left corner of the controls group. However, that does not mean that {{hl|x {{=}} 1;}} and {{hl|y {{=}} 1;}} will move it to the bottom right corner since the height and width of the control can be {{hl|> 1}}! If the position or height/width of any child controls cause any part of the child control to fall outside the dimensions of the controls group then scrollbars will become visible. This allows for the creation of scrollable text controls for example. Any commands operating on the Controls Group also affect the child controls. For example <sqf inline>_ctrlGroup ctrlShow false</sqf> will also hide the children of the group. Control groups are not visible by themselves, therefore most of the common attributes, eg. colorBackground, do not apply.
{{Important|*A generalised screw-up occurs in Arrowhead rscControlGroup where color is not specified for V and H scrollbars and shadow should not have been specified. As a result any deriving class:  
{{Feature|important|A generalised screw-up occurs in Arrowhead rscControlGroup where color is not specified for V and H scrollbars and shadow should not have been specified. As a result any deriving class:  
**a) cannot inherit the existing scrollbar
* a) cannot inherit the existing scrollbar
**b) must repeat the entire thing with the addition of color.}}
* b) must repeat the entire thing with the addition of color.}}
|gallery=
|gallery=
|commands =
|commands =
Line 11: Line 12:
}}
}}


{{DoLater|Find out which attributes actually work because most of them have no effect}}
{{CT|abc start}}
{{CT|abc start}}
=== A ===
{{CT|attribute
|name=adminOnly
|type1=Number
|value1=1
|description=
}}


=== C ===
=== C ===
Line 27: Line 20:
|value1=class controls
|value1=class controls
{
{
class Subcontrol: RscText
class Subcontrol : RscText
{
{
text = "This is a sub control";
text = "This is a sub control";
Line 37: Line 30:
};
};
|description=Any user added [[Arma: GUI Configuration#Controls|controls]] to be contained within the controls group.
|description=Any user added [[Arma: GUI Configuration#Controls|controls]] to be contained within the controls group.
}}
=== D ===
{{CT|attribute
|name=disableCustomColors
|type1=Number
|value1=1
|description=
}}
=== G ===
{{CT|attribute
|name=gunH
|type1=Number
|value1=0.15
|description=
}}
{{CT|attribute
|name=gunW
|type1=Number
|value1=0.113
|description=
}}
}}


=== H ===
=== H ===
{{CT|attribute
|name=highlightAnimLength
|type1=Number
|value1=1.2
|description=
}}
{{CT|attribute
|name=highlightColorFrom
|type1=Array
|value1={1,1,1,0.25}
|description=
}}
{{CT|attribute
|name=highlightColorTo
|type1=Array
|value1={1,1,1,0.5}
|description=
}}
{{CT|attribute
{{CT|attribute
|name=HScrollbar
|name=HScrollbar
Line 108: Line 57:
All available properties of '''VScrollbar''' and '''HScrollbar'''. Not all available properties make sense for each of these as outlined below.
All available properties of '''VScrollbar''' and '''HScrollbar'''. Not all available properties make sense for each of these as outlined below.
{{{!}}class="wikitable" border="1" align="left" cellpadding="3" cellspacing="0" {{!}}
{{{!}}class="wikitable" border="1" align="left" cellpadding="3" cellspacing="0" {{!}}
! colspan="6" bgcolor="#bbbbff" {{!}} Properties
! colspan="6" {{!}} Properties
{{!}}-
{{!}}-
! bgcolor="#ddddff" {{!}} Name
! Name
! bgcolor="#ddddff" {{!}} Type
! Type
! bgcolor="#ddddff" {{!}} Remark
! Remark
! bgcolor="#ddddff" {{!}} Scrollbar
! Scrollbar
! bgcolor="#ddddff" {{!}} VScrollbar
! VScrollbar
! bgcolor="#ddddff" {{!}} HScrollbar
! HScrollbar


{{!}}-
{{!}}-
Line 155: Line 104:
{{!}} '''autoScrollEnabled'''
{{!}} '''autoScrollEnabled'''
{{!}} [[Number]]
{{!}} [[Number]]
{{!}} 1 - enabled, 0 - disabled, Does not work if there a interactive controls within the controlsGroup e.g Buttons
{{!}} 1 - enabled, 0 - disabled, auto-scrolling does not work when the control group or one of its parents is in focus ([[ctrlSetFocus]] or clicking on the control group)
{{!}} <center>x</center>
{{!}} <center>x</center>
{{!}} <center>x</center>
{{!}} <center>x</center>
Line 162: Line 111:
{{!}} '''autoScrollSpeed'''
{{!}} '''autoScrollSpeed'''
{{!}} [[Number]]
{{!}} [[Number]]
{{!}} Default -1, smaller numbers scroll faster, '''cannot''' be forced to scroll backwards by supplying negative numbers
{{!}} Default -1, smaller numbers scroll faster, '''cannot''' be forced to scroll backwards by supplying negative numbers. Setting to < 0 disables auto-scrolling
{{!}} <center>x</center>
{{!}} <center>x</center>
{{!}} <center>x</center>
{{!}} <center>x</center>
Line 217: Line 166:
{{!}}-
{{!}}-
{{!}}}<br clear="all">
{{!}}}<br clear="all">
}}
=== L ===
{{CT|attribute
|name=lineHeight
|type1=String
|value1="1.2 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)"
|description=
}}
=== M ===
{{CT|attribute
|name=magH
|type1=Number
|value1=0.074
|description=
}}
{{CT|attribute
|name=magW
|type1=Number
|value1=0.055
|description=
}}
}}


=== S ===
=== S ===
<!-- This should probably be moved as default values for displays? -->
{{CT|attribute
{{CT|attribute
|name=scriptName
|name=scriptName
|type1=String
|type1=String
|value1="RscHorizontalCompass"
|value1="RscHorizontalCompass"
|description=
|description= Used along with scriptPath to compile a UI's script at preStart.
scriptName is both the actual name of the file #.sqf and the name of the compiled function in uinamespace #_script.
<br/>UI's only have their scripts compiled if they exist in one of...
* configFile
* configFile >> RscTitles
* configFile >> RscInGameUI
* configFile >> CfgEden >> Attributes
at preStart.
<br/>UI's that have had their scripts compiled in this way can then use an onLoad event with BIS_fnc_initDisplay to call the function when the display is created.
}}
}}


<!-- This should probably be moved as default values for displays? -->
{{CT|attribute
{{CT|attribute
|name=scriptPath
|name=scriptPath
|type1=String
|type1=String
|value1="EnochCommon"
|value1="EnochCommon"
|description=
|description= Used along with scriptName to compile UI's script at preStart.
}}
The string value is not the path itself but instead is a lookup from CfgScriptPaths.
 
<br/>UI's only have their scripts compiled if they exist in one of...
{{CT|attribute
* configFile
|name=soundClick
* configFile >> RscTitles
|type1=Array
* configFile >> RscInGameUI
|value1={"",0.1,1}
* configFile >> CfgEden >> Attributes
|description=
at preStart.
}}
<br/>UI's that have had their scripts compiled in this way can then use an onLoad event with BIS_fnc_initDisplay to call the function when the display is created.
 
{{CT|attribute
|name=soundDoubleClick
|type1=Array
|value1={"",0.1,1}
|description=
}}
 
{{CT|attribute
|name=soundPush
|type1=Array
|value1={"",0.1,1}
|description=
}}
 
{{CT|attribute
|name=spacing
|type1=Number
|value1=0.002
|description=
}}
}}


Line 308: Line 224:
};
};
|description=Settings relatied to the vertical (↕) scrollbar. For details see [[#HScrollbar]]
|description=Settings relatied to the vertical (↕) scrollbar. For details see [[#HScrollbar]]
}}
=== W ===
{{CT|attribute
|name=weaponH
|type1=Number
|value1=0.15
|description=
}}
{{CT|attribute
|name=weaponW
|type1=Number
|value1=0.226
|description=
}}
}}


Line 334: Line 235:
deletable = 0;
deletable = 0;
fade = 0;
fade = 0;
class VScrollbar: ScrollBar
class VScrollbar : ScrollBar
{
{
color[] = {1,1,1,1};
color[] = {1,1,1,1};
Line 340: Line 241:
autoScrollEnabled = 1;
autoScrollEnabled = 1;
};
};
class HScrollbar: ScrollBar
class HScrollbar : ScrollBar
{
{
color[] = {1,1,1,1};
color[] = {1,1,1,1};
Line 360: Line 261:


== Other examples ==
== Other examples ==
<syntaxhighlight lang="cpp">class Dialog
<syntaxhighlight lang="cpp">
class Dialog
{
{
    idd = -1;
idd = -1;
    class Controls
class Controls
    {
{
        class _CT_CONTROLS_GROUP
class _CT_CONTROLS_GROUP
        {
{
            type = 15;
type = 15;
            idc = -1;
idc = -1;
            style = 16;
style = 16;
            x = 0;
x = 0;
            y = 0;
y = 0;
            w = 1;
w = 1;
            h = 1;
h = 1;
            shadow = 0;
shadow = 0;
            class ScrollBar
class ScrollBar
            {
{
                color[] = {1,1,1,0.6};
color[] = {1,1,1,0.6};
                colorActive[] = {1,1,1,1};
colorActive[] = {1,1,1,1};
                colorDisabled[] = {1,1,1,0.3};
colorDisabled[] = {1,1,1,0.3};
                thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
                arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
                arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
                border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
            };
};
            class VScrollbar: ScrollBar
class VScrollbar : ScrollBar
            {
{
                width = 0.021;
width = 0.021;
                autoScrollSpeed = -1;
autoScrollSpeed = -1;
                autoScrollDelay = 5;
autoScrollDelay = 5;
                autoScrollRewind = 0;
autoScrollRewind = 0;
                shadow = 0;
shadow = 0;
            };
};
            class HScrollbar: ScrollBar
class HScrollbar : ScrollBar
            {
{
                height = 0.028;
height = 0.028;
                shadow = 0;
shadow = 0;
            };
};
            class Controls
class Controls
            {
{
                class _CT_EDIT
class _CT_EDIT
                {
{
                    idc = -1;
idc = -1;
                    onLoad = "params ['_ctrl']; _ctrl ctrlSetText loadFile 'A3\functions_f\Actions\fn_packStaticWeapon.sqf'";
onLoad = "params ['_ctrl']; _ctrl ctrlSetText loadFile 'A3\functions_f\Actions\fn_packStaticWeapon.sqf'";
                    type = 2;
type = 2;
                    style = 16;
style = 16;
                    autocomplete = "";
autocomplete = "";
                    canModify = 1;
canModify = 1;
                    colorBackground[] = {0,0,0,0.5};
colorBackground[] = {0,0,0,0.5};
                    colorText[] = {1,1,1,1};
colorText[] = {1,1,1,1};
                    colorDisabled[] = {1,1,1,0.25};
colorDisabled[] = {1,1,1,0.25};
                    colorSelection[] = {"(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};
colorSelection[] = {"(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};
                    text = "";
text = "";
                    x = 0;
x = 0;
                    y = 0;
y = 0;
                    w = 2;
w = 2;
                    h = 2;
h = 2;
                    sizeEx = 0.05;
sizeEx = 0.05;
                    font = "RobotoCondensedLight";
font = "RobotoCondensedLight";
                };
};
            };
};
        };
};
    };
};
};</syntaxhighlight>
};
</syntaxhighlight>
 
 
[[Category: Control Types]]

Latest revision as of 10:58, 6 December 2023

Introduction

Container control for other controls. The child controls have to be defined in the controls subclass. The child controls' positions are calculated relatively to the control group, so x = 0; and y = 0; moves the child control to the top left corner of the controls group. However, that does not mean that x = 1; and y = 1; will move it to the bottom right corner since the height and width of the control can be > 1! If the position or height/width of any child controls cause any part of the child control to fall outside the dimensions of the controls group then scrollbars will become visible. This allows for the creation of scrollable text controls for example. Any commands operating on the Controls Group also affect the child controls. For example _ctrlGroup ctrlShow false will also hide the children of the group. Control groups are not visible by themselves, therefore most of the common attributes, eg. colorBackground, do not apply.

A generalised screw-up occurs in Arrowhead rscControlGroup where color is not specified for V and H scrollbars and shadow should not have been specified. As a result any deriving class:
  • a) cannot inherit the existing scrollbar
  • b) must repeat the entire thing with the addition of color.


Related commands & functions

Related User Interface Eventhandlers

Alphabetical Order

TokenNames common to most controls, such as x, y, w, h, text, idc... can be found here.
Not all of the listed attributes might have an effect nor might the list be complete. All attributes were gathered with this config crawler.
#define CT_CONTROLS_GROUP 15



C

controls

Type
Class
Description
Any user added controls to be contained within the controls group.
class controls
{
	class Subcontrol : RscText
	{
		text = "This is a sub control";
		x = 0;
		y = 0;
		w = 10 * GUI_GRID_W;
		h = 1 * GUI_GRID_H;
	};
};


H

HScrollbar

Type
Class
Description
Settings relatied to the horizontal (↔) scrollbar.

All available properties of VScrollbar and HScrollbar. Not all available properties make sense for each of these as outlined below.

Properties
Name Type Remark Scrollbar VScrollbar HScrollbar
color color array Color of thumb and arrow heads, also arrow backgrounds when pressed.
x
x
x
colorActive color array Color when the scrollbar is focused.
x
x
x
colorDisabled color array Color when the scrollbar is deactivated.
x
x
x
width Number Width of the controlsGroup's scroll bars in screen space dimensions. Setting to 0 will cause no scrollbar to be shown even if a child falls outside the controlsGroup's dimensions
x
x
height Number Height of the controlsGroup's scroll bars in screen space dimensions. Setting to 0 will cause no scrollbar to be shown even if a child falls outside the controlsGroup's dimensions
x
x
autoScrollEnabled Number 1 - enabled, 0 - disabled, auto-scrolling does not work when the control group or one of its parents is in focus (ctrlSetFocus or clicking on the control group)
x
x
autoScrollSpeed Number Default -1, smaller numbers scroll faster, cannot be forced to scroll backwards by supplying negative numbers. Setting to < 0 disables auto-scrolling
x
x
autoScrollDelay Number Time in seconds before autoScroll starts, restarts after user input and time before rewind happens when the end has been reached
x
x
autoScrollRewind Number 0 - disable, 1 - enabled : If autoScroll reaches the bottom of the controlsGroup it will wait autoScrollDelay then fade out, scroll back to the top, fade back in, wait autoScrollDelay before proceeding to start auto scrolling again.
x
x
thumb String Path to texture or Procedural Texture "#(argb,8,8,3)color(1,1,1,1)";
x
x
x
arrowEmpty/Full String Path to texture or Procedural Texture "#(argb,8,8,3)color(1,1,1,1)";
x
x
x
border String Path to texture or Procedural Texture "#(argb,8,8,3)color(1,1,1,1)";
x
x
x
shadow Number
x
x
x
scrollSpeed Number Default 0.06 : Speed of user vertical scroll input when using the mouse wheel, can be set to 0 to disable the user from being able to scroll, can be set to negative number to reverse scroll direction.
x
x
x

class HScrollbar
{
	height = 0;
	color[] = {1,1,1,1};
	colorActive[] = {1,1,1,1};
	colorDisabled[] = {1,1,1,0.3};
	thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
	arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
	arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
	border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
	shadow = 0;
	scrollSpeed = 0.06;
	width = 0;
	autoScrollEnabled = 0;
	autoScrollSpeed = -1;
	autoScrollDelay = 5;
	autoScrollRewind = 0;
};


S

scriptName

Type
String
Description
Used along with scriptPath to compile a UI's script at preStart.

scriptName is both the actual name of the file #.sqf and the name of the compiled function in uinamespace #_script.
UI's only have their scripts compiled if they exist in one of...

  • configFile
  • configFile >> RscTitles
  • configFile >> RscInGameUI
  • configFile >> CfgEden >> Attributes

at preStart.
UI's that have had their scripts compiled in this way can then use an onLoad event with BIS_fnc_initDisplay to call the function when the display is created.

scriptName = "RscHorizontalCompass";


scriptPath

Type
String
Description
Used along with scriptName to compile UI's script at preStart.

The string value is not the path itself but instead is a lookup from CfgScriptPaths.
UI's only have their scripts compiled if they exist in one of...

  • configFile
  • configFile >> RscTitles
  • configFile >> RscInGameUI
  • configFile >> CfgEden >> Attributes

at preStart.
UI's that have had their scripts compiled in this way can then use an onLoad event with BIS_fnc_initDisplay to call the function when the display is created.

scriptPath = "EnochCommon";


V

VScrollbar

Type
Class
Description
Settings relatied to the vertical (↕) scrollbar. For details see #HScrollbar
class VScrollbar
{
	width = 0;
	color[] = {1,1,1,1};
	autoScrollEnabled = 1;
	colorActive[] = {1,1,1,1};
	colorDisabled[] = {1,1,1,0.3};
	thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
	arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
	arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
	border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
	shadow = 0;
	scrollSpeed = 0.06;
	height = 0;
	autoScrollSpeed = -1;
	autoScrollDelay = 5;
	autoScrollRewind = 0;
};



Default Classes

Arma 3
AddOns: Classes need to be initialised first with class SomeClass;

Missions: Since Arma 3 v2.02 one can use import SomeClass; to initialise a class (see the import keyword).

In older versions, use "Default" call BIS_fnc_exportGUIBaseClasses; and paste the result into the description.ext.

RscControlsGroup

class RscControlsGroup
{
	deletable = 0;
	fade = 0;
	class VScrollbar : ScrollBar
	{
		color[] = {1,1,1,1};
		width = 0.021;
		autoScrollEnabled = 1;
	};
	class HScrollbar : ScrollBar
	{
		color[] = {1,1,1,1};
		height = 0.028;
	};
	class Controls
	{
	};
	type = CT_CONTROLS_GROUP;
	idc = -1;
	x = 0;
	y = 0;
	w = 1;
	h = 1;
	shadow = 0;
	style = ST_MULTI;
};

Other examples

class Dialog
{
	idd = -1;
	class Controls
	{
		class _CT_CONTROLS_GROUP
		{
			type = 15;
			idc = -1;
			style = 16;
			x = 0;
			y = 0;
			w = 1;
			h = 1;
			shadow = 0;
			class ScrollBar
			{
				color[] = {1,1,1,0.6};
				colorActive[] = {1,1,1,1};
				colorDisabled[] = {1,1,1,0.3};
				thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
				arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
				arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
				border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
			};
			class VScrollbar : ScrollBar
			{
				width = 0.021;
				autoScrollSpeed = -1;
				autoScrollDelay = 5;
				autoScrollRewind = 0;
				shadow = 0;
			};
			class HScrollbar : ScrollBar
			{
				height = 0.028;
				shadow = 0;
			};
			class Controls
			{
				class _CT_EDIT
				{
					idc = -1;
					onLoad = "params ['_ctrl']; _ctrl ctrlSetText loadFile 'A3\functions_f\Actions\fn_packStaticWeapon.sqf'";
					type = 2;
					style = 16;
					autocomplete = "";
					canModify = 1;
					colorBackground[] = {0,0,0,0.5};
					colorText[] = {1,1,1,1};
					colorDisabled[] = {1,1,1,0.25};
					colorSelection[] = {"(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};
					text = "";
					x = 0;
					y = 0;
					w = 2;
					h = 2;
					sizeEx = 0.05;
					font = "RobotoCondensedLight";
				};
			};
		};
	};
};