DialogControls-Toolbox: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(see also)
(example)
Line 59: Line 59:
class MyRscToolbox  
class MyRscToolbox  
{
{
  idc = 200;
onLoad = "_this select 0 lbSetCurSel 4;";
  type = CT_TOOLBOX; //defined constant (6)
  style = ST_LEFT; //defined constant (0)


  x = 0.1;
idc = -1;
  y = 0.2;
type = 6; // CT_TOOLBOX
  w = 0.2;
style = 2; // ST_CENTER
  h = 0.15;
 
 
x = 0.25;
  colorText[] = {1, 1, 1, 1};
y = 0.25;
  color[] = {0, 0, 0, 1};   // seems nothing to change, but define it to avoid error!
w = 0.5;
  colorTextSelect[] = {1, 0, 0, 1};
h = 0.1;
  colorSelect[] = {0, 0, 1, 1};
 
  colorTextDisable[] = {0.4, 0.4, 0.4, 1};
colorText[] = {0, 1, 0, 1};
  colorDisable[] = {0.4, 0.4, 0.4, 1};
colorTextSelect[] = {1, 0, 0, 1};
 
colorBackground[] = {0, 0, 1, 0.3};
colorSelectedBg[] = {0, 0, 0, 0.2};
font = "RobotoCondensed";
sizeEx = 0.04;
  font = "Zeppelin32";
onToolBoxSelChanged = "hint str _this";
  sizeEx = 0.0208333;
  rows = 3;
columns = 3;
  columns = 2;
rows = 2;
  strings[] = {"Entry 1","Entry 2","Entry 3","Entry 4","Entry 5","Entry 6"};
  values[] = {1,1,0,1,0,0};


  // Only a simple user interface event handler to show some response
strings[] = {"Entry 1","Entry 2","Entry 3","Entry 4","Entry 5","Entry 6"};
  onToolBoxSelChanged = "hint format[""Toolbox change:\n%1\nEntry#:%2"",(_this select 0),(_this select 1)];"
checked_strings[] = {"[Entry 1]","[Entry 2]","[Entry 3]","[Entry 4]","[Entry 5]","[Entry 6]"};
tooltips[] = {"Entry 1 tip","Entry 2 tip","Entry 3 tip","Entry 4 tip","Entry 5 tip","Entry 6 tip"};
values[] = {1,2,3,4,5,6};
};
};
</syntaxhighlight>
</syntaxhighlight>

Revision as of 20:33, 21 May 2019

CT_TOOLBOX Type=6

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

A Toolbox is a set of buttons, ordered by columns and rows. Only one can be active at a time and one is always selected (the first one by default). For Toolbox with multiple selections see CT_CHECKBOXES.

Properties
Name Type Remark
color color array Color of the selection box when this the control isn't active.
colorTextSelect color array Color of the text when selected.
colorSelect color array Color of the selection box.
colorTextDisable color array Color of control text when the control is disabled.
colorDisable color array Color of the selection box when the control is disabled.
rows integer Amount of rows to display
columns integer Amount of columns to display
colorSelectedBg color array The color of the background when selected.
strings string array Text for each toolbox entry
values float array Currently serve no purpose. Believed to be associated with each option, however there is no way of retrieving them.


A Toolbox Control from example code with a hint dialog from UI event handler
  • Example:
class MyRscToolbox 
{
	onLoad = "_this select 0 lbSetCurSel 4;";

	idc = -1;
	type = 6; // CT_TOOLBOX
	style = 2; // ST_CENTER

	x = 0.25;
	y = 0.25;
	w = 0.5;
	h = 0.1;

	colorText[] = {0, 1, 0, 1};
	colorTextSelect[] = {1, 0, 0, 1};

	colorBackground[] = {0, 0, 1, 0.3};
	colorSelectedBg[] = {0, 0, 0, 0.2};
	
	font = "RobotoCondensed";
	sizeEx = 0.04;
	
	onToolBoxSelChanged = "hint str _this";
	
	columns = 3;
	rows = 2;

	strings[] = {"Entry 1","Entry 2","Entry 3","Entry 4","Entry 5","Entry 6"};
	checked_strings[] = {"[Entry 1]","[Entry 2]","[Entry 3]","[Entry 4]","[Entry 5]","[Entry 6]"};
	tooltips[] = {"Entry 1 tip","Entry 2 tip","Entry 3 tip","Entry 4 tip","Entry 5 tip","Entry 6 tip"};
	values[] = {1,2,3,4,5,6};
};

Notice: As you see in the example image, the returned entry number from the onToolBoxSelChanged event handler starts at zero (0)! So if you have 6 toolbox entrys, the first is 0 and the last is 5!