|
|
(9 intermediate revisions by 3 users not shown) |
Line 1: |
Line 1: |
| ==CT_TOOLBOX Type=6==
| | #REDIRECT [[CT_TOOLBOX]] |
| | |
| '''TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.'''
| |
| | |
| A Toolbox is a set of options, 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]].
| |
| | |
| [[Image:CToolBox.jpg|thumb|right|450px|A Toolbox Control from example code with a hint dialog from UI event handler]]
| |
| {| border="1" align="left" cellpadding="3" cellspacing="0" |
| |
| ! colspan="3" bgcolor="#bbbbff" | Properties
| |
| |-
| |
| ! bgcolor="#ddddff" | Name
| |
| ! bgcolor="#ddddff" | Type
| |
| ! bgcolor="#ddddff" | Remark
| |
| |-
| |
| | '''colorText'''
| |
| | color array
| |
| | color of the non-selected option text
| |
| |-
| |
| | '''colorTextSelect'''
| |
| | color array
| |
| | color of the selected option text
| |
| |-
| |
| | '''colorBackground'''
| |
| | color array
| |
| | color of the background when option is not selected
| |
| |-
| |
| | '''colorSelectedBg'''
| |
| | color array
| |
| | color of the background when option is selected
| |
| |-
| |
| | '''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 arrange options into
| |
| |-
| |
| | '''columns'''
| |
| | integer
| |
| | amount of columns to arrange options into
| |
| |-
| |
| | '''strings'''
| |
| | string array
| |
| | options texts to display
| |
| |-
| |
| | '''checked_strings'''
| |
| | string array
| |
| | options texts to display when an option is selected
| |
| |-
| |
| | '''values'''
| |
| | float array
| |
| | Numerical values associated with items. Can be retrieved or set with [[lbValue]] and [[lbSetValue]]
| |
| |-
| |
| | '''tooltips'''
| |
| | string array
| |
| | Tooltips for each option
| |
| |-
| |
| |}<br clear="all">
| |
| | |
| * '''Example:'''
| |
| <syntaxhighlight lang=cpp>
| |
| 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};
| |
| };
| |
| </syntaxhighlight>
| |
| | |
| {{Informative | The returned option number from the <tt>onToolBoxSelChanged</tt> event handler starts at 0. So if you have 6 toolbox entries, the first is 0 and the last is 5}}
| |
| | |
| <code>[[with]] [[uiNamespace]] [[do]]
| |
| {
| |
| ctrl = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty" [[ctrlCreate]] ["MyRscToolbox", -1];
| |
| };</code>
| |
| | |
| '''Script commands for use with ToolBoxes:'''
| |
| * [[lbCurSel]] - returns index of selected option
| |
| * [[lbSetCurSel]] - sets option selected
| |
| * [[lbValue]] - returns value currently set on given option
| |
| * [[lbSetValue]] - sets value on given option
| |
| * [[lbSetText]] - sets string on given option
| |
| * [[lbClear]] - clears all strings from toolbox table
| |
| * [[lbAdd]] - adds a string to cleared toolbox table
| |
| | |
| {{Informative | When Toolbox style is <tt>ST_PICTURE</tt>, the <tt>strings</tt> property is treated as array of textures, and <tt>checked_strings<tt> property is ignored}}
| |
|
| |
| <syntaxhighlight lang=cpp>
| |
| class MyRscToolbox
| |
| {
| |
| onLoad = "_this select 0 lbSetCurSel 4;";
| |
| | |
| idc = -1;
| |
| type = 6; // CT_TOOLBOX
| |
| style = 2098; // ST_PICTURE + ST_CENTER + ST_KEEP_ASPECT_RATIO
| |
| | |
| x = 0.25;
| |
| y = 0.25;
| |
| w = 0.5;
| |
| h = 0.5;
| |
| | |
| 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[] = {"\A3\ui_f\data\map\markers\nato\c_car.paa","\A3\ui_f\data\map\markers\nato\c_car.paa","\A3\ui_f\data\map\markers\nato\c_car.paa","\A3\ui_f\data\map\markers\nato\c_car.paa","\A3\ui_f\data\map\markers\nato\c_car.paa","\A3\ui_f\data\map\markers\nato\c_car.paa"};
| |
| 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>
| |
| [[Category: Dialogs]]
| |