DialogControls-CheckBoxes: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
m (Text replacement - "#redirect " to "#REDIRECT ")
 
(12 intermediate revisions by 3 users not shown)
Line 1: Line 1:
'''TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.'''
#REDIRECT [[CT_CHECKBOXES]]
=== Checkboxes ===
The Checkboxes are a set of state change buttons, ordered by columns and rows. Unlike the Toolbox Control more than one button can become active.
 
{| border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
|-
! bgcolor="#ddddff" | Name
! bgcolor="#ddddff" | Type
! bgcolor="#ddddff" | Remark
|-
| '''idc'''
| integer
| the unique ID number of this dialog. Can be -1 if you don't require access to the dialog itself from within a script.
|-
| '''colorText'''
| color array
| color of the control text.
|-
| '''color'''
| color array
| color of border from selected entry, if other control has focus.
|-
| '''colorTextSelect'''
| color array
| color of text if selected
|-
| '''colorSelect'''
| color array
| color of border from selected entry.
|-
| '''colorTextDisable'''
| color array
| color of control text, if control is disabled.
|-
| '''colorDisable'''
| color array
| seems nothing to change, but define it to avoid errors.
|-
| '''font'''
| float
| the font to use. See the list of [[Fonts#Available_Fonts|available fonts]] for possible values
|-
| '''sizeEx'''
| float
| the font size of text (0 to 1)
|-
| '''rows'''
| integer
| amount of rows to display
|-
| '''columns'''
| integer
| amount of columns to display
|-
| '''color'''
| color array
| color of the control surrounding lines.
|-
| '''strings'''
| string array
| text for each toolbox entry
|-
|}<br clear="all">
 
Checkboxes corresponding '''type''' property is ''CT_CHECKBOXES''.
 
[[Image:CheckboxesControl.jpg|thumb|200px|A Checkboxes Control from example code with a hint dialog from UI event handler]]
* '''Example:'''
<code><nowiki>class MyRscCheckBoxes {
  idc = 200;
  type = CT_CHECKBOXES; // defined contant (7)
  style = ST_CENTER; // defined constat (0)
 
  x = 0.1;
  y = 0.18;
  w = 0.15;
  h = 0.15;
 
  colorText[] = {1, 0, 0, 1};
  color[] = {0, 1, 0, 1};  //seems nothing to change, but define to avaoid errors
  colorTextSelect[] = {0, 0.8, 0, 1};
  colorSelect[] = {0, 0, 0, 1};
  colorTextDisable[] = {0.4, 0.4, 0.4, 1};
  colorDisable[] = {0.4, 0.4, 0.4, 1};
 
  font = "Zeppelin32";
  sizeEx = 0.0208333;
 
  rows = 3;
  columns = 2;
  strings[] = {"Entry 1","Entry 2","Entry 3","Entry 4","Entry 5","Entry 6"};
 
  //Simple UI event handler to show response on clicks
  onCheckBoxesSelChanged = "hint format[""Checkbox change:\n%1\nEntry#: %2\nNewState: %3"",(_this select 0),(_this select 1),(_this select 2)];"
};
</nowiki></code>
 
'''Notice:'''
As you see in the example image, the returned entry number from the ''onCheckBoxesSelChanged'' event handler starts at zero (0)! So if you have 6 toolbox entrys, the first is 0 and the last is 5!
'''Notice:'''
You must add this line : '''coloSelectedBg[] = {0, 0, 0, 0};''' (for setting the selected box color)
 
Functions for CheckBoxes: [[cbSetChecked]], [[ctrlChecked]], [[ctrlSetChecked]], [[cbChecked]]
 
[[Category: Dialogs]]

Latest revision as of 14:36, 30 December 2020

Redirect to: