CT_LISTBOX

From Bohemia Interactive Community
Jump to navigation Jump to search


Introduction

The listbox displays a list of items. With ST_MULTI it is possible to select multiple entries. For listBoxes, the usage of 'ST_' style constants (ST_MULTI & ST_TITLE_BAR) behave differently than expected for other controls, so use the corresponding 'LB_' (LB_TEXTURES & LB_MULTI) list box style variants instead.
WuChaoRen ctListBox.png

style = LB_TEXTURES; // solid scrollbar
style = LB_MULTI; // multiple item selection


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_LISTBOX 5


A

active

Type
String
Description
n/a
active = "a3\ui_f\data\gui\rsc\rscdisplaysinglemission\done_ca.paa";


addons

Type
String
Description
n/a
addons = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_addons_ca.paa";


allowedFilePatching

Type
String
Description
n/a
allowedFilePatching = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_version_ca.paa";


arrowEmpty

Type
String
Description
n/a
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";


arrowFull

Type
String
Description
n/a
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";


autoScrollDelay

Type
Number
Description
n/a
autoScrollDelay = 5;


autoScrollRewind

Type
Number
Description
n/a
autoScrollRewind = 0;


autoScrollSpeed

Type
Number
Description
n/a
autoScrollSpeed = -1;


C

canDrag

Type
Number
Description
Allow dragging and dropping listbox items similar to how the inventory works.
canDrag = 0;


collisionColor

Type
Array
Description
Color of the collision key binding; default {1,0,0,1} - Only relevant to config keys dialog (type = 5; idc = 102)
collisionColor[] = {"(profilenamespace getvariable ['IGUI_ERROR_RGB_R',0.8])","(profilenamespace getvariable ['IGUI_ERROR_RGB_G',0.0])","(profilenamespace getvariable ['IGUI_ERROR_RGB_B',0.0])",1};


collisionColorFirstKey

Type
Array
Description
n/a
collisionColorFirstKey[] = {"(profilenamespace getvariable ['IGUI_WARNING_RGB_R',0.8])","(profilenamespace getvariable ['IGUI_WARNING_RGB_G',0.5])","(profilenamespace getvariable ['IGUI_WARNING_RGB_B',0.0])",1};


color

Type
Array
Description
n/a
color[] = {0.95,0.95,0.95,1};


colorAI

Type
Array
Description
n/a
colorAI[] = {1,0,0,1};


colorNobody

Type
Array
Description
n/a
colorNobody[] = {1,1,1,0.25};


colorPicture

Type
Array
Description
n/a
colorPicture[] = {1,1,1,1};


colorPictureDisabled

Type
Array
Description
n/a
colorPictureDisabled[] = {1,1,1,0.25};


colorPictureRight

Type
Array
Description
n/a
colorPictureRight[] = {1,1,1,1};


colorPictureRightDisabled

Type
Array
Description
n/a
colorPictureRightDisabled[] = {1,1,1,0.25};


colorPictureRightSelected

Type
Array
Description
n/a
colorPictureRightSelected[] = {1,1,1,1};


colorPictureSelected

Type
Array
Description
n/a
colorPictureSelected[] = {1,1,1,1};


colorPingBad

Type
Array
Description
n/a
colorPingBad[] = {1,0,0,1};


colorPingGood

Type
Array
Description
n/a
colorPingGood[] = {0,1,0,1};


colorPingPoor

Type
Array
Description
n/a
colorPingPoor[] = {1,0.6,0,1};


colorPingUnknown

Type
Array
Description
n/a
colorPingUnknown[] = {0.4,0.4,0.4,1};


colorPlayer

Type
Array
Description
n/a
colorPlayer[] = {1,1,0,1};


colorScrollbar

Type
Array
Description
n/a
colorScrollbar[] = {1,0,0,0};


colorSelect

Type
Array
Description
Text color of a selected item.
colorSelect[] = {1,1,1,1};


colorSelect2

Type
Array
Description
Text color to pulsate to from colorSelect.
colorSelect2[] = {0,0,0,1};


colorSelect2Right

Type
Array
Description
n/a
colorSelect2Right[] = {0,0,0,1};


colorSelectBackground

Type
Array
Description
Background color of a selected entry.
colorSelectBackground[] = {0.95,0.95,0.95,1};


colorSelectBackground2

Type
Array
Description
Background color to pulsate to from colorSelectBackground of a selected entry.
colorSelectBackground2[] = {1,1,1,0.5};


colorSelectRight

Type
Array
Description
n/a
colorSelectRight[] = {0,0,0,1};


colorShadow

Type
Array
Description
n/a
colorShadow[] = {0,0,0,0.5};


colorTextRight

Type
Array
Description
n/a
colorTextRight[] = {1,1,1,1};


columns

Type
Number, Class
Description
n/a

Number example:

columns = 1;

Class example:

class Columns
{
	class ColumnFavorite
	{
		x = "1.2 * (((safezoneW / safezoneH) min 1.2) / 40) + (SafezoneX)";
		w = "(2 * (((safezoneW / safezoneH) min 1.2) / 40))";
	};
	class ColumnServer
	{
		x = "2.7 * (((safezoneW / safezoneH) min 1.2) / 40) + (SafezoneX)";
		w = "(11 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
	};
	class ColumnType
	{
		x = "safezoneX + (15 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
		w = "3 * (((safezoneW / safezoneH) min 1.2) / 40)";
	};
	class ColumnMission
	{
		x = "safezoneX + (18.3 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
		w = "(10.5 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.45*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
	};
	class ColumnState
	{
		x = "safezoneX + (29.1 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.9*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
		w = "3 * (((safezoneW / safezoneH) min 1.2) / 40)";
	};
	class ColumnPlayers
	{
		x = "safezoneX + (32.4 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.9*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
		w = "3 * (((safezoneW / safezoneH) min 1.2) / 40)";
	};
	class ColumnPing
	{
		x = "safezoneX + (35.7 * (((safezoneW / safezoneH) min 1.2) / 40)) + 0.9*(safezoneW - ((safezoneW / safezoneH) min 1.2))";
		w = "3 * (((safezoneW / safezoneH) min 1.2) / 40)";
	};
};


D

disabled

Type
String
Description
n/a
disabled = "a3\ui_f\data\gui\rsc\rscdisplaysinglemission\none_ca.paa";


disabledAI

Type
String
Description
n/a
disabledAI = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayersetup\disabledai_ca.paa";


disabledCtrlColor

Type
Array
Description
n/a
disabledCtrlColor[] = {1,1,1,0.5};


disabledKeyColor

Type
Array
Description
Color of the disabled key binding; default {0.3,0.3,0.3,1} - Only relevant to config keys dialog (type = 5; idc = 102)
disabledKeyColor[] = {0.4,0.4,0.4,1};


DLCTemplate

Type
Class
Description
n/a
class DLCTemplate
{
	class controls
	{
		class DlcBg
		{
			idc = 101;
			text = "\A3\Ui_f\data\GUI\Rsc\RscDisplayInventory\InventoryStripe_ca.paa";
			color[] = {1,1,1,1};
			x = 0;
			y = 0;
			w = "1.8 * (((safezoneW / safezoneH) min 1.2) / 40)";
			h = "1.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
		};
		class DlcIcon
		{
			idc = 100;
			text = "";
			color[] = {1,1,1,1};
			x = "0 * (((safezoneW / safezoneH) min 1.2) / 40)";
			y = "0 * (((safezoneW / safezoneH) min 1.2) / 40)";
			w = "1 * (((safezoneW / safezoneH) min 1.2) / 40)";
			h = "1 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
		};
	};
};


E

enabled

Type
String
Description
n/a
enabled = "a3\ui_f\data\gui\rsc\rscdisplaysinglemission\done_ca.paa";


enabledAI

Type
String
Description
n/a
enabledAI = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayersetup\enabledai_ca.paa";


I

idcx

Type
Number
Description
Used in the Arsenal display for unknown reason.
idcx = 974;


itemBackground

Type
Array
Description
n/a
itemBackground[] = {1,1,1,0.1};


Items

Type
Class
Description
Default entries for the listbox columns.
// Yes, this is a vanilla config :D
class Items
{
	class Item0
	{
		text = "LOL";
		textRight = "ROFL";
		tooltip = "OMG";
		picture = "\a3\Ui_f\data\Map\Markers\Military\warning_CA.paa";
		pictureRight = "\a3\Ui_f\data\Map\Markers\Military\unknown_CA.paa";
		color[] = {1,0,1,1};
		colorRight[] = {1,1,0,1};
		colorPicture[] = {0,1,1,1};
		colorPictureSelected[] = {1,0,0,1};
		colorPictureDisabled[] = {0,0,0,1};
		colorPictureRight[] = {0,1,0,1};
		colorPictureRightSelected[] = {0,0,1,1};
		colorPictureRightDisabled[] = {0,0,0,1};
		data = "WTF";
		value = 42;
		default = 0;
	};
	class AnotherItem
	{
		text = "O RLY";
		default = 1;
	};
};


itemSpacing

Type
Number
Description
n/a
itemSpacing = 0;


L

ListScrollBar

Type
Class
Description
Prior to Arma 3 use ScrollBar. Scrollbars might not show if h and w properties of the ListBox are not 0. see also DialogControls-Sliders
class ListScrollBar
{
	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;
	width = 0;
	height = 0;
	autoScrollSpeed = -1;
	autoScrollDelay = 5;
	autoScrollRewind = 0;
};


locked

Type
String
Description
n/a
locked = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_locked_ca.paa";


M

mainCollumW

Type
Number
Description
Width of the left column 0..1; default 0.4 - Only relevant to config keys dialog (type = 5; idc = 102)
mainCollumW = 0.4;


maxHistoryDelay

Type
Number
Description
n/a
maxHistoryDelay = 1;


mods

Type
String
Description
n/a
mods = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_mods_ca.paa";


N

none

Type
String
Description
n/a
none = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_none_ca.paa";


P

password

Type
String
Description
n/a
password = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_password_ca.paa";


period

Type
Number
Description
Controls how fast the color changes from colorXXX to colorXXX2.
period = 1.2;


R

rowHeight

Type
Number, String
Description
The height of a single row.

Number example:

rowHeight = 0;

String example:

rowHeight = "1.75 * (((((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";


rows

Type
Number
Description
n/a
rows = 8;


S

secndCollumW

Type
Number
Description
Width of the right column 0..1; default 0.6 - Only relevant to config keys dialog (type = 5; idc = 102)
secndCollumW = 0.6;


serverDislike

Type
String
Description
n/a
serverDislike = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\mp_serverdislike_ca.paa";


serverEmpty

Type
String
Description
n/a
serverEmpty = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\mp_serverempty_ca.paa";


serverLike

Type
String
Description
n/a
serverLike = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\mp_serverlike_ca.paa";


sizeEx2

Type
String
Description
n/a
sizeEx2 = "0.8 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";


soundSelect

Type
Array
Description
Sound played when an entry is selected.
soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1};


star

Type
String
Description
n/a
star = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_star_ca.paa";


V

version

Type
String
Description
n/a
version = "a3\ui_f\data\gui\rsc\rscdisplaymultiplayer\sessions_version_ca.paa";


W

wholeHeight

Type
Number
Description
n/a
wholeHeight = 0.21;



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.

RscListBox

class RscListBox
{
	deletable = 0;
	fade = 0;
	access = 0;
	type = CT_LISTBOX;
	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 : ScrollBar
	{
		color[] = {1,1,1,1};
		autoScrollEnabled = 1;
	};
	x = 0;
	y = 0;
	w = 0.3;
	h = 0.3;
	style = LB_TEXTURES;
	font = "RobotoCondensed";
	sizeEx = GUI_TEXT_SIZE_MEDIUM;
	shadow = 0;
	colorShadow[] = {0,0,0,0.5};
	period = 1.2;
	maxHistoryDelay = 1;
};

Scripting Example

Code Picture

{ private _ctrl = _x; { _ctrl lbAdd getText (_x >> "displayName"); _ctrl lbSetPicture [_foreachindex,getText (_x >> "texture")]; _ctrl lbSetTooltip [_foreachindex,getText (_x >> "displayName")]; } forEach ("true" configClasses (configFile >> "CfgRanks")); _ctrl lbSetCurSel 0;

WuChaoRen lbCommand001.png

private _current = lbCurSel _ctrl; _ctrl lbSetData [_current,"hi"]; private _data = _ctrl lbData _current; private _pic = _ctrl lbPicture _current; _ctrl lbSetValue [_current, 1]; private _value = _ctrl lbValue _current; private _size = lbSize _ctrl; private _color = _ctrl lbColor _current; _ctrl lbSetColor [_current, [(_color select 0) / 2, (_color select 1) / 4, 0, 1]];

WuChaoRen lbColor.png

lbSort [_ctrl, "DESC"]; lbSortByValue _ctrl;

WuChaoRen lbSortByValue.png

if (_ctrl lbIsSelected _current) then { _ctrl lbDelete _current; lbClear _ctrl; }; } forEach [_CT_COMBO, _CT_LISTBOX, _CT_XLISTBOX, _CT_XCOMBO];

WuChaoRen lbDelete.png WuChaoRen lbClear.png

CT_LISTBOX command family can be used with CT_COMBO, CT_LISTBOX, CT_XLISTBOX and CT_XCOMBO.