DialogControls-Tree: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "{{Informative|TokenNames common to most controls, such as x, y, w, h, text, idc... are not listed here.}}" to "{{Informative|TokenNames common to most controls, such as x, y, w, h, text, idc... can be found [[Arma:_GUI_Configuration...)
m (page overhaul)
Line 1: Line 1:
__TOC__
==CT_TREE Type=12==
==CT_TREE Type=12==
The CT_TREE, also referred to as tree view (tv), is a control with similar functionality as the [[CT_LISTBOX]]. In addition to that it supports multiple levels of entries as well as a search functionality.
=== Properties ===
{{Informative|TokenNames common to most controls, such as x, y, w, h, text, idc... can be found [[Arma:_GUI_Configuration#Common_Properties|'''here''']].}}
{{Informative|TokenNames common to most controls, such as x, y, w, h, text, idc... can be found [[Arma:_GUI_Configuration#Common_Properties|'''here''']].}}
 
{|class="wikitable" border="1" align="left" cellpadding="3" cellspacing="0" |
{| class="wikitable" border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="3" bgcolor="#bbbbff" | Properties
|-
|-
Line 9: Line 12:
! bgcolor="#ddddff" | Remark
! bgcolor="#ddddff" | Remark
|-
|-
| '''colorSelect'''
| '''borderSize'''
| color array
| [[Boolean]]
|  
| Shows a border around the control
|-
|-
| '''colorBorder'''
| '''colorBorder'''
| color array
| [[Color]]
|  
| With borderSize = 1 determines the color of that border
|-
|-
| '''colorArrow'''
| '''colorArrow'''
| color array
| [[Color]]
|  
| Has no effect but without it an error is thrown
|-
| '''colorLines'''
| [[Color]]
| These lines connect the different entries for better clarity
|-
| '''colorMarked'''
| [[Color]]
| Background color of all subsequently selected entries when multiselectEnabled = 1;
|-
| '''colorMarkedSelected'''
| [[Color]]
| Background color of the first selected entry with multiselectEnabled = 1;
|-
| '''colorMarkedText'''
| [[Color]]
| Text color of secondarly selected entries with multiselectEnabled = 1;
|-
| '''colorPicture'''
| [[Color]]
| Left picture color of an unselected entry
|-
| '''colorPictureDisabled'''
| [[Color]]
| Left picture color when control is disabled
|-
| '''colorPictureRight'''
| [[Color]]
| Right picture color of an unselected entry
|-
| '''colorPictureRightDisabled'''
| [[Color]]
| Right picture color when control is disabled
|-
| '''colorPictureRightSelected'''
| [[Color]]
| Right picture color of an selected entry
|-
| '''colorPictureSelected'''
| [[Color]]
| Left picture color of an selected entry
|-
| '''colorSearch'''
| [[Color]]
| Color of then entries that fit the search of the idcSearch listbox
|-
| '''colorSelect'''
| [[Color]]
| Entry's background when multiselectEnabled = 0;
|-
| '''colorSelectBackground'''
| [[Color]]
| Not used?
|-
| '''colorSelectText'''
| [[Color]]
| Text color of a selected entry with multiselectEnabled = 0;
|-
|-
| '''maxHistoryDelay '''
| '''expandedTexture'''
| float
| [[Color]]
|  
| "Arrow" texture on the left side, if non is given ("") a minus with box will be displayed
|-
|-
| '''disableKeyboardSearch'''
| '''hiddenTexture'''
| boolean
| [[String]]
|  
| "Arrow" texture on the left side, if non is given ("") a plus with box will be displayed
|-
|-
| '''expandOnDoubleclick'''
| [[Boolean]]
| Enable/disable expanding and collapsing with double-click
|-
| '''idcSearch'''
| [[Integer]]
| idc of a CT_EDIT control which functions as the search input
|-
| '''maxHistoryDelay'''
| [[Number]]
| Time since last keyboard type search to reset it
|-
| '''multiselectEnabled'''
| [[Boolean]]
| Enable/disable multi selection with CTRL or SHIFT to select all entries up to the first selected entry
|-
| '''rowHeight'''
| [[Boolean]]?
| Not used?
|}<br clear="all">
|}<br clear="all">


 
=== Example config ===
*'''Example Config (A3 1.28 Template):'''
[[File:CT TREE.png|thumb|A CT_TREE in A3 1.96.]]
[[file:WuChaoRen_CTTree001.png]] [[file:WuChaoRen_CTTree005.png]] [[file:WuChaoRen_CTTree003.png]] [[file:WuChaoRen_CTTree004.png]]
<syntaxhighlight lang="cpp">class _CT_TREE
<syntaxhighlight lang="cpp">class _CT_TREE
{
{
  access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified)
/* Common properties */
  idc = CT_TREE; // Control identification (without it, the control won't be displayed)
idc = 100;
  idcSearch = 1337; //The ctrlEdit with this IDC will automatically be used as search input. Can be any unique number
moving = 0;
  type = CT_TREE; // Type is 12
type = CT_TREE;
  style = ST_LEFT; // Style
style = ST_LEFT;
  default = 0; // Control selected by default (only one within a display can be used)
x = GUI_GRID_CENTER_X + 10 * GUI_GRID_CENTER_W;
  blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect.
y = GUI_GRID_CENTER_Y + 1 * GUI_GRID_CENTER_H;
w = 20 * GUI_GRID_CENTER_W;
h = 23 * GUI_GRID_CENTER_H;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
font = "RobotoCondensed";
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,0};
colorDisabled[] = {1,1,1,0.25};
shadow = 0;
access = 0;


  x = 12 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; // Horizontal coordinates
/* CT_TREE specific properties */
  y = 3 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; // Vertical coordinates
idcSearch = -1;
  w = 10 * GUI_GRID_CENTER_W; // Width
colorSelect[] = {1,1,1,0.7};
  h = 3 * GUI_GRID_CENTER_H; // Height
colorSelectText[] = {0,0,0,1};
colorBorder[] = {0,0,0,0};
colorSearch[] =
{
"(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])"
};
colorMarked[] = {0.2,0.3,0.7,1};
colorMarkedText[] = {0,0,0,1};
colorMarkedSelected[] = {0,0.5,0.5,1};
multiselectEnabled = 0;
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {0,0,0,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {0,0,0,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
colorArrow[] = {1,1,1,1};
maxHistoryDelay = 1;
colorSelectBackground[] = {0,0,0,0.5};
colorLines[] = {0,0,0,0};
class ScrollBar: ScrollBar
{
};
expandedTexture = "A3\ui_f\data\gui\rsccommon\rsctree\expandedTexture_ca.paa";
hiddenTexture = "A3\ui_f\data\gui\rsccommon\rsctree\hiddenTexture_ca.paa";
rowHeight = 0.0439091;
borderSize = 0;
expandOnDoubleclick = 1;


  colorBorder[] = {0,0,0,1}; // Frame color
/* CT_TREE user interface eventhandlers */
 
onTreeSelChanged = "systemChat str ['onTreeSelChanged',_this]; false";
  colorBackground[] = {0.2,0.2,0.2,1}; // Fill color
onTreeLButtonDown = "systemChat str ['onTreeLButtonDown',_this]; false";
  colorSelect[] = {1,0.5,0,1}; // Selected item fill color (when multiselectEnabled is 0)
onTreeDblClick = "systemChat str ['onTreeDblClick',_this]; false";
  colorMarked[] = {1,0.5,0,0.5}; // Marked item fill color (when multiselectEnabled is 1)
onTreeExpanded = "systemChat str ['onTreeExpanded',_this]; false";
  colorMarkedSelected[] = {1,0.5,0,1}; // Selected item fill color (when multiselectEnabled is 1)
onTreeCollapsed = "systemChat str ['onTreeCollapsed',_this]; false";
onTreeMouseMove = "systemChat str ['onTreeMouseMove',_this]; false";
onTreeMouseHold = "systemChat str ['onTreeMouseHold',_this]; false";
onTreeMouseExit = "systemChat str ['onTreeMouseExit',_this]; false";
};</syntaxhighlight>


  sizeEx = GUI_GRID_CENTER_H; // Text size
=== Commands ===
  font = GUI_FONT_NORMAL; // Font from CfgFontFamilies
<div style="columns: 3">
  shadow = 1; // Shadow (0 - none, 1 - N/A, 2 - black outline)
*[[tvAdd]]
  colorText[] = {1,1,1,1}; // Text color
*[[tvCollapse]]
  colorSelectText[] = {1,1,1,1}; // Selected text color (when multiselectEnabled is 0)
*[[tvCollapseAll]]
  colorMarkedText[] = {1,1,1,1}; // Selected text color (when multiselectEnabled is 1)
*[[tvCount]]
 
*[[tvCurSel]]
  tooltip = "CT_TREE"; // Tooltip text
*[[tvData]]
  tooltipColorShade[] = {0,0,0,1}; // Tooltip background color
*[[tvDelete]]
  tooltipColorText[] = {1,1,1,1}; // Tooltip text color
*[[tvExpand]]
  tooltipColorBox[] = {1,1,1,1}; // Tooltip frame color
*[[tvExpandAll]]
 
*[[tvPicture]]
  multiselectEnabled = 1; // Allow selecting multiple items while holding Ctrl or Shift
*[[tvSetColor]]
  expandOnDoubleclick = 1; // Expand/collapse item upon double-click
*[[tvSetCurSel]]
  hiddenTexture = "A3\ui_f\data\gui\rsccommon\rsctree\hiddenTexture_ca.paa"; // Expand icon
*[[tvSetData]]
  expandedTexture = "A3\ui_f\data\gui\rsccommon\rsctree\expandedTexture_ca.paa"; // Collapse icon
*[[tvSetPicture]]
  maxHistoryDelay = 1; // Time since last keyboard type search to reset it
*[[tvSetPictureColor]]
 
*[[tvSetPictureColorDisabled]]
  // Scrollbar configuration
*[[tvSetPictureColorSelected]]
  class ScrollBar
*[[tvSetPictureRight]]
  {
*[[tvSetPictureRightColor]]
    width = 0; // width of ScrollBar
*[[tvSetPictureRightColorDisabled]]
    height = 0; // height of ScrollBar
*[[tvSetPictureRightColorSelected]]
    scrollSpeed = 0.01; // scroll speed of ScrollBar
*[[tvSetText]]
 
*[[tvSetTooltip]]
    arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; // Arrow
*[[tvSetValue]]
    arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; // Arrow when clicked on
*[[tvSort]]
    border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; // Slider background (stretched vertically)
*[[tvSortByValue]]
    thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; // Dragging element (stretched vertically)
*[[tvText]]
 
*[[tvTooltip]]
    color[] = {1,1,1,1}; // Scrollbar color
*[[tvValue]]
  };
</div>
 
  colorDisabled[] = {0,0,0,0}; // Does nothing, but must be present, otherwise an error is shown
  colorArrow[] = {0,0,0,0}; // Does nothing, but must be present, otherwise an error is shown
 
  onCanDestroy = "systemChat str ['onCanDestroy',_this]; true";
  onDestroy = "systemChat str ['onDestroy',_this]; false";
  onMouseEnter = "systemChat str ['onMouseEnter',_this]; false";
  onMouseExit = "systemChat str ['onMouseExit',_this]; false";
  onSetFocus = "systemChat str ['onSetFocus',_this]; false";
  onKillFocus = "systemChat str ['onKillFocus',_this]; false";
  onKeyDown = "systemChat str ['onKeyDown',_this]; false";
  onKeyUp = "systemChat str ['onKeyUp',_this]; false";
  onMouseButtonDown = "systemChat str ['onMouseButtonDown',_this]; false";
  onMouseButtonUp = "systemChat str ['onMouseButtonUp',_this]; false";
  onMouseButtonClick = "systemChat str ['onMouseButtonClick',_this]; false";
  onMouseButtonDblClick = "systemChat str ['onMouseButtonDblClick',_this]; false";
  onMouseZChanged = "systemChat str ['onMouseZChanged',_this]; false";
  onMouseMoving = "";
  onMouseHolding = "";
 
  onTreeSelChanged = "systemChat str ['onTreeSelChanged',_this]; false";
  onTreeLButtonDown = "systemChat str ['onTreeLButtonDown',_this]; false";
  onTreeDblClick = "systemChat str ['onTreeDblClick',_this]; false";
  onTreeExpanded = "systemChat str ['onTreeExpanded',_this]; false";
  onTreeCollapsed = "systemChat str ['onTreeCollapsed',_this]; false";
  //onTreeMouseMove = "systemChat str ['onTreeMouseMove',_this]; false"; // Causing CTD
  //onTreeMouseHold = "systemChat str ['onTreeMouseHold',_this]; false"; // Causing CTD
  onTreeMouseExit = "systemChat str ['onTreeMouseExit',_this]; false";
};</syntaxhighlight>
[[Category: Dialogs|Tree]]
[[Category: Dialogs|Tree]]

Revision as of 01:43, 30 March 2020

CT_TREE Type=12

The CT_TREE, also referred to as tree view (tv), is a control with similar functionality as the CT_LISTBOX. In addition to that it supports multiple levels of entries as well as a search functionality.

Properties

TokenNames common to most controls, such as x, y, w, h, text, idc... can be found here.
Properties
Name Type Remark
borderSize Boolean Shows a border around the control
colorBorder Color With borderSize = 1 determines the color of that border
colorArrow Color Has no effect but without it an error is thrown
colorLines Color These lines connect the different entries for better clarity
colorMarked Color Background color of all subsequently selected entries when multiselectEnabled = 1;
colorMarkedSelected Color Background color of the first selected entry with multiselectEnabled = 1;
colorMarkedText Color Text color of secondarly selected entries with multiselectEnabled = 1;
colorPicture Color Left picture color of an unselected entry
colorPictureDisabled Color Left picture color when control is disabled
colorPictureRight Color Right picture color of an unselected entry
colorPictureRightDisabled Color Right picture color when control is disabled
colorPictureRightSelected Color Right picture color of an selected entry
colorPictureSelected Color Left picture color of an selected entry
colorSearch Color Color of then entries that fit the search of the idcSearch listbox
colorSelect Color Entry's background when multiselectEnabled = 0;
colorSelectBackground Color Not used?
colorSelectText Color Text color of a selected entry with multiselectEnabled = 0;
expandedTexture Color "Arrow" texture on the left side, if non is given ("") a minus with box will be displayed
hiddenTexture String "Arrow" texture on the left side, if non is given ("") a plus with box will be displayed
expandOnDoubleclick Boolean Enable/disable expanding and collapsing with double-click
idcSearch Integer idc of a CT_EDIT control which functions as the search input
maxHistoryDelay Number Time since last keyboard type search to reset it
multiselectEnabled Boolean Enable/disable multi selection with CTRL or SHIFT to select all entries up to the first selected entry
rowHeight Boolean? Not used?


Example config

A CT_TREE in A3 1.96.
class _CT_TREE
{
	/* Common properties */
	idc = 100;
	moving = 0;
	type = CT_TREE;
	style = ST_LEFT;
	x = GUI_GRID_CENTER_X + 10 * GUI_GRID_CENTER_W;
	y = GUI_GRID_CENTER_Y + 1 * GUI_GRID_CENTER_H;
	w = 20 * GUI_GRID_CENTER_W;
	h = 23 * GUI_GRID_CENTER_H;
	sizeEx = GUI_TEXT_SIZE_MEDIUM;
	font = "RobotoCondensed";
	colorText[] = {1,1,1,1};
	colorBackground[] = {0,0,0,0};
	colorDisabled[] = {1,1,1,0.25};
	shadow = 0;
	access = 0;

	/* CT_TREE specific properties */
	idcSearch = -1;
	colorSelect[] = {1,1,1,0.7};
	colorSelectText[] = {0,0,0,1};
	colorBorder[] = {0,0,0,0};
	colorSearch[] =
	{
		"(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])"
	};
	colorMarked[] = {0.2,0.3,0.7,1};
	colorMarkedText[] = {0,0,0,1};
	colorMarkedSelected[] = {0,0.5,0.5,1};
	multiselectEnabled = 0;
	colorPicture[] = {1,1,1,1};
	colorPictureSelected[] = {0,0,0,1};
	colorPictureDisabled[] = {1,1,1,0.25};
	colorPictureRight[] = {1,1,1,1};
	colorPictureRightSelected[] = {0,0,0,1};
	colorPictureRightDisabled[] = {1,1,1,0.25};
	colorArrow[] = {1,1,1,1};
	maxHistoryDelay = 1;
	colorSelectBackground[] = {0,0,0,0.5};
	colorLines[] = {0,0,0,0};
	class ScrollBar: ScrollBar
	{
	};
	expandedTexture = "A3\ui_f\data\gui\rsccommon\rsctree\expandedTexture_ca.paa";
	hiddenTexture = "A3\ui_f\data\gui\rsccommon\rsctree\hiddenTexture_ca.paa";
	rowHeight = 0.0439091;
	borderSize = 0;
	expandOnDoubleclick = 1;

	/* CT_TREE user interface eventhandlers */
	onTreeSelChanged = "systemChat str ['onTreeSelChanged',_this]; false";
	onTreeLButtonDown = "systemChat str ['onTreeLButtonDown',_this]; false";
	onTreeDblClick = "systemChat str ['onTreeDblClick',_this]; false";
	onTreeExpanded = "systemChat str ['onTreeExpanded',_this]; false";
	onTreeCollapsed = "systemChat str ['onTreeCollapsed',_this]; false";
	onTreeMouseMove = "systemChat str ['onTreeMouseMove',_this]; false";
	onTreeMouseHold = "systemChat str ['onTreeMouseHold',_this]; false";
	onTreeMouseExit = "systemChat str ['onTreeMouseExit',_this]; false";
};

Commands