DialogControls-ListBoxes: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(ListBox implementation requires LIstScrollBar class to be present now)
(template updated)
Line 306: Line 306:
  };</nowiki></code>
  };</nowiki></code>


===RscListNBox===
===RscListNBox (A3 1.28 Template)===
class RscListNBox
[[File:WuChaoRen 000.png]] [[File:WuChaoRen 001.png]] [[File:WuChaoRen 002.png]] [[File:WuChaoRen 003.png]]
{
<code><nowiki>
  access = 0; // allow alterations / additions to, but not erasure of, tokennames in this class.
                class _CT_LISTNBOX             
              // this equally affects child classes. they cannot be removed, nor can their tokenNames be erased, only altered
{
              // to completely remove or alter a child class (in this case scrollbar), this parent class must be inherited
access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified)
              // then again, perhaps irrelevant, perhaps it's simply being a root class that causes all this
idc = CT_LISTNBOX; // Control identification (without it, the control won't be displayed)
/*
type = CT_LISTNBOX; // Type
** standard stuff
style = ST_LEFT + LB_TEXTURES; // Style
*/
default = 0; // Control selected by default (only one within a display can be used)
  type = CT_LISTNBOX;// 102;
blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect.
  style =ST_MULTI;
 
  w = 0.4;   h = 0.4;  
x = 29 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; // Horizontal coordinates
  font = "TahomaB";  
y = 15 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; // Vertical coordinates
  sizeEx = 0.04;  
w = 10 * GUI_GRID_CENTER_W; // Width
  colorText[] = {0.8784, 0.8471, 0.651, 1};  
h = 3 * GUI_GRID_CENTER_H; // Height
  colorBackground[] = {0, 0, 0, 1};  
 
/*
colorSelectBackground[] = {1,0.5,0,1}; // Selected item fill color
** type specific
colorSelectBackground2[] = {0,0,0,1}; // Selected item fill color (oscillates between this and colorSelectBackground)
*/
 
  autoScrollSpeed = -1;  
sizeEx = GUI_GRID_CENTER_H; // Text size
  autoScrollDelay = 5;  
font = GUI_FONT_NORMAL; // Font from CfgFontFamilies
  autoScrollRewind = 0;  
shadow = 0; // Shadow (0 - none, 1 - directional, color affected by colorShadow, 2 - black outline)
  arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";  
colorText[] = {1,1,1,1}; // Text and frame color
  arrowFull = "#(argb,8,8,3)color(1,1,1,1)";  
colorDisabled[] = {1,1,1,0.5}; // Disabled text color
  columns[] = {0.3, 0.6, 0.7};  
colorSelect[] = {1,1,1,1}; // Text selection color
  color[] = {1, 1, 1, 1};  
colorSelect2[] = {1,1,1,1}; // Text selection color (oscillates between this and colorSelect)
  colorScrollbar[] = {0.95, 0.95, 0.95, 1};  
colorShadow[] = {0,0,0,0.5}; // Text shadow color (used only when shadow is 1)
  colorSelect[] = {0.95, 0.95, 0.95, 1};  
 
  colorSelect2[] = {0.95, 0.95, 0.95, 1};  
tooltip = "CT_LISTNBOX"; // Tooltip text
  colorSelectBackground[] = {0, 0, 0, 1};  
tooltipColorShade[] = {0,0,0,1}; // Tooltip background color
  colorSelectBackground2[] = {0.8784, 0.8471, 0.651, 1};
tooltipColorText[] = {1,1,1,1}; // Tooltip text color
  drawSideArrows = 0;  
tooltipColorBox[] = {1,1,1,1}; // Tooltip frame color
  idcLeft = -1;  
 
  idcRight = -1;  
columns[] = {0.1,0.4}; // Horizontal coordinates of columns (relative to list width, in range from 0 to 1)
  maxHistoryDelay = 1;  
 
  rowHeight = 0;  
drawSideArrows = 1; // 1 to draw buttons linked by idcLeft and idcRight on both sides of selected line. They are resized to line height
  soundSelect[] = {"", 0.1, 1};  
idcLeft = 1000; // Left button IDC
  period = 1;  
idcRight = 1001; // Right button IDC
  shadow = 2;  
 
  class ScrollBar
period = 1; // Oscillation time between colorSelect/colorSelectBackground2 and colorSelect2/colorSelectBackground when selected
  {
 
  arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
rowHeight = GUI_GRID_CENTER_H; // Row height
  arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
maxHistoryDelay = 1; // Time since last keyboard type search to reset it
  border = "#(argb,8,8,3)color(1,1,1,1)";
 
  color[] = {1,1,1,0.6};
soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1}; // Sound played when an item is selected
  colorActive[] = {1,1,1,1};
 
  colorDisabled[] = {1,1,1,0.3};
// Scrollbar configuration (applied only when LB_TEXTURES style is used)
  thumb = "#(argb,8,8,3)color(1,1,1,1)";
class ListScrollBar
  };
{
};
width = 0; // width of ListScrollBar
class dialog
height = 0; // height of ListScrollBar
{
scrollSpeed = 0.01; // scrollSpeed of ListScrollBar
  class controls
 
  {
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; // Arrow
    class MyLbox:RscListNBox
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; // Arrow when clicked on
    {
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; // Slider background (stretched vertically)
        x=y=wherever;
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; // Dragging element (stretched vertically)
        canDrag=true;
 
        rows=10;
color[] = {1,1,1,1}; // Scrollbar color
        lineSpacing = 1.3;
};
    };
 
  };
onCanDestroy = "systemChat str ['onCanDestroy',_this]; true";
};
onDestroy = "systemChat str ['onDestroy',_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 = "";
 
onLBSelChanged = "systemChat str ['onLBSelChanged',_this]; false";
onLBDblClick = "systemChat str ['onLBDblClick',_this]; false";
};
</nowiki></code>
[[Category: Dialogs]]
[[Category: Dialogs]]

Revision as of 16:26, 9 September 2014

CT_LISTBOX=5

CT_XLISTBOX=42

CT_LISTNBOX=102

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

Notes for future:

For list boxes, 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.

style = LB_TEXTURES; // solid scrollbar
style = LB_MULTI; // multiple item selection
Properties Applies to
Name Type Remark 5 42 102
active boolean x
autoScroll... integers applies to Speed,Delay,Rewind x x
arrowEmpty/Full color x x x
border texture x
canDrag boolean x x
collisionColor color x
colorScrollbar color x
color color x
colorPlayerItem color x
colorActive color x
colorDisabled color x
colorSelect color x x x
colorSelect2 color x x
colorSelectBackground color x x
colorSelectBackground2 color x x
columns float array define the left starting position of each column. The values are offsets ratios (not spacing ratios). Tip: Use {-0.01} in first column to fix unwanted offset, if desired. x
disabled/enabled boolean x
disabledCtrlColor color x
disabledKeyColor color x
drawSideArrows boolean Each row can be linked to 2 arrow buttons which are shown on the left and right of the row. x
idcLeft/Right integer the IDC of the control to be used for the left/right button. x
mainCollumW float x
secndCollumW float x
LineSpacing float x
maxHistoryDelay float x x
period float? probably flash period x x
rowHeight float the height of a single row in the elapsed box. x x
rows integer x
SoundSelect class x x x
ListScrollBar class see DialogControls-Sliders x x
xColumn1,2,3 float x


RscListNBox

  • Using -1 for idcLeft/idcRight will use the full row width. Using a valid idc will reserve sides for arrows and link with those controls.
  • idcLeft/idcRight bug?: Using -1 for either idc will link to first control with an idc using -1, instead of treating it as an unused idc. Workaround: number every idc in dialog rather than leaving any idc as -1.

Examples

RscListBox

class RscListBox { access = 0; type = 5; style = 0; w = 0.4; h = 0.4; font = "TahomaB"; sizeEx = 0.04; rowHeight = 0; colorText[] = {1,1,1,1}; colorScrollbar[] = {1,1,1,1}; colorSelect[] = {0,0,0,1}; colorSelect2[] = {1,0.5,0,1}; colorSelectBackground[] = {0.6,0.6,0.6,1}; colorSelectBackground2[] = {0.2,0.2,0.2,1}; colorBackground[] = {0,0,0,1}; maxHistoryDelay = 1.0; soundSelect[] = {"",0.1,1}; period = 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)"; shadow = 0; class ListScrollBar : ScrollBar { color[] = {1,1,1,0.6}; colorActive[] = {1,1,1,1}; colorDisabled[] = {1,1,1,0.3}; thumb = "#(argb,8,8,3)color(1,1,1,1)"; arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; border = "#(argb,8,8,3)color(1,1,1,1)"; shadow = 0; }; };

RscXListBox

class RscXListBox
{
type = 42;
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.3};
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
arrowFull = "#(argb,8,8,3)color(1,0.5,0,1)";
border = "#(argb,8,8,3)color(0,0,0,1)";
colorSelect[] = {1,1,1,1};
colorText[] = {1,1,1,0.8};
soundSelect[] = {"",0.1,1};
};</nowiki>

RscListNBox (A3 1.28 Template)

WuChaoRen 000.png WuChaoRen 001.png WuChaoRen 002.png WuChaoRen 003.png class _CT_LISTNBOX { access = 0; // Control access (0 - ReadAndWrite, 1 - ReadAndCreate, 2 - ReadOnly, 3 - ReadOnlyVerified) idc = CT_LISTNBOX; // Control identification (without it, the control won't be displayed) type = CT_LISTNBOX; // Type style = ST_LEFT + LB_TEXTURES; // Style default = 0; // Control selected by default (only one within a display can be used) blinkingPeriod = 0; // Time in which control will fade out and back in. Use 0 to disable the effect. x = 29 * GUI_GRID_CENTER_W + GUI_GRID_CENTER_X; // Horizontal coordinates y = 15 * GUI_GRID_CENTER_H + GUI_GRID_CENTER_Y; // Vertical coordinates w = 10 * GUI_GRID_CENTER_W; // Width h = 3 * GUI_GRID_CENTER_H; // Height colorSelectBackground[] = {1,0.5,0,1}; // Selected item fill color colorSelectBackground2[] = {0,0,0,1}; // Selected item fill color (oscillates between this and colorSelectBackground) sizeEx = GUI_GRID_CENTER_H; // Text size font = GUI_FONT_NORMAL; // Font from CfgFontFamilies shadow = 0; // Shadow (0 - none, 1 - directional, color affected by colorShadow, 2 - black outline) colorText[] = {1,1,1,1}; // Text and frame color colorDisabled[] = {1,1,1,0.5}; // Disabled text color colorSelect[] = {1,1,1,1}; // Text selection color colorSelect2[] = {1,1,1,1}; // Text selection color (oscillates between this and colorSelect) colorShadow[] = {0,0,0,0.5}; // Text shadow color (used only when shadow is 1) tooltip = "CT_LISTNBOX"; // Tooltip text tooltipColorShade[] = {0,0,0,1}; // Tooltip background color tooltipColorText[] = {1,1,1,1}; // Tooltip text color tooltipColorBox[] = {1,1,1,1}; // Tooltip frame color columns[] = {0.1,0.4}; // Horizontal coordinates of columns (relative to list width, in range from 0 to 1) drawSideArrows = 1; // 1 to draw buttons linked by idcLeft and idcRight on both sides of selected line. They are resized to line height idcLeft = 1000; // Left button IDC idcRight = 1001; // Right button IDC period = 1; // Oscillation time between colorSelect/colorSelectBackground2 and colorSelect2/colorSelectBackground when selected rowHeight = GUI_GRID_CENTER_H; // Row height maxHistoryDelay = 1; // Time since last keyboard type search to reset it soundSelect[] = {"\A3\ui_f\data\sound\RscListbox\soundSelect",0.09,1}; // Sound played when an item is selected // Scrollbar configuration (applied only when LB_TEXTURES style is used) class ListScrollBar { width = 0; // width of ListScrollBar height = 0; // height of ListScrollBar scrollSpeed = 0.01; // scrollSpeed of ListScrollBar arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa"; // Arrow arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa"; // Arrow when clicked on border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa"; // Slider background (stretched vertically) thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa"; // Dragging element (stretched vertically) color[] = {1,1,1,1}; // Scrollbar color }; onCanDestroy = "systemChat str ['onCanDestroy',_this]; true"; onDestroy = "systemChat str ['onDestroy',_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 = ""; onLBSelChanged = "systemChat str ['onLBSelChanged',_this]; false"; onLBDblClick = "systemChat str ['onLBDblClick',_this]; false"; };