BIS fnc initSliderValue: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Generated by BIS_fnc_exportFunctionsToWiki)
 
m (Text replacement - "{{Feature|Informative|" to "{{Feature|informative|")
 
(47 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{{RV|type=function


{{Function|= Comments
|game1= arma3
____________________________________________________________________________________________
|version1= 1.58


| arma3 |= Game name
|gr1= Eden Editor


|1.00|= Game version
|descr= Initialises a slider attribute control within the [[:Category:Eden Editor|Eden Editor]]. Can also be used outside of [[:Category:Eden Editor|Eden Editor]]. {{Feature|informative| The slider and the edit control have to share the same controls group!}}
____________________________________________________________________________________________


| <pre>/*
|s1= [ctrlSlider, ctrlEdit, unit, default] call [[BIS_fnc_initSliderValue]]
Author: Karel Moricky


Description:
|p1= ctrlSlider: [[Control]] - slider control, usually the first control within the controls group
Initialize slider with edit box showing its value
|p2= ctrlEdit: [[Control]] - edit Box, usually the second control within the controls group
|p3= unit: [[String]] - measurement unit added behind the number within the edit box ("%" by default)
|p4= default: [[Number]] - when present, only the value is set, functionality is not initialized


Parameter(s):
|r1= [[Nothing]]
0: CONTROL - slider
1: CONTROL - edit box
2: STRING - measurement unit added behind the number ("%" by default)
3: NUMBER - default value. When present, only the value is set, functionality is not initialized


Returns:
|x1= <sqf>[_this controlsGroupCtrl 100, _this controlsGroupCtrl 101, "m", 50] call BIS_fnc_initSliderValue;</sqf>
NOTHING
*/


</pre><small>''(Placeholder description extracted from the function header by [[BIS_fnc_exportFunctionsToWiki]])''</small> |= Description
|x2= <sqf>// Execute in Eden Editor to preview the functionality
____________________________________________________________________________________________
if !(is3DEN) exitWith {};


| <!-- [] call [[BIS_fnc_initSliderValue]]; --> |= Syntax
private _display = findDisplay 313;
|p1= |= Parameter 1
private _GRID_H = pixelGrid * pixelH * 0.5;
private _GRID_W = pixelGrid * pixelW * 0.5;


| |= Return value
// Function only works if slider and edit control share the same group
____________________________________________________________________________________________
private _ctrlGroup = _display ctrlCreate ["ctrlControlsGroupNoScrollbars", -100];
_ctrlGroup ctrlSetPosition [0, 0, 101 * _GRID_W, 5 * _GRID_H];


|x1= <code></code> |=  
// Setup the slider
____________________________________________________________________________________________
private _ctrlSlider = _display ctrlCreate ["ctrlXSliderH", -101, _ctrlGroup];
_ctrlSlider ctrlSetPosition [0, 0, 50 * _GRID_W, 5 * _GRID_H];
_ctrlSlider sliderSetRange [100, 2000];


| |= See also
// Setup the edit control
private _ctrlEdit = _display ctrlCreate ["ctrlEdit", -102, _ctrlGroup];
_ctrlEdit ctrlSetPosition [51 * _GRID_W, 0, 25 * _GRID_W, 5 * _GRID_H];


}}
_ctrlSlider ctrlCommit 0;
_ctrlEdit ctrlCommit 0;
_ctrlGroup ctrlCommit 0;


<h3 style="display:none">Notes</h3>
// Set default value
<dl class="command_description">
[_ctrlSlider, _ctrlEdit, "m", 200] call BIS_fnc_initSliderValue;
<!-- Note Section BEGIN -->


<!-- Note Section END -->
// Added eventhandlers to controls
</dl>
[_ctrlSlider, _ctrlEdit, "m"] call BIS_fnc_initSliderValue;</sqf>


<h3 style="display:none">Bottom Section</h3>
|seealso= [[Eden Editor: Configuring Attributes]]
[[Category:Function Group: Default|{{uc:initSliderValue}}]]
}}
[[Category:Functions|{{uc:initSliderValue}}]]
[[Category:{{Name|arma3}}: Functions|{{uc:initSliderValue}}]]

Latest revision as of 01:24, 2 February 2024

Hover & click on the images for description

Description

Description:
Initialises a slider attribute control within the Eden Editor. Can also be used outside of Eden Editor.
The slider and the edit control have to share the same controls group!
Execution:
call
Groups:
Eden Editor

Syntax

Syntax:
[ctrlSlider, ctrlEdit, unit, default] call BIS_fnc_initSliderValue
Parameters:
ctrlSlider: Control - slider control, usually the first control within the controls group
ctrlEdit: Control - edit Box, usually the second control within the controls group
unit: String - measurement unit added behind the number within the edit box ("%" by default)
default: Number - when present, only the value is set, functionality is not initialized
Return Value:
Nothing

Examples

Example 1:
[_this controlsGroupCtrl 100, _this controlsGroupCtrl 101, "m", 50] call BIS_fnc_initSliderValue;
Example 2:
// Execute in Eden Editor to preview the functionality if !(is3DEN) exitWith {}; private _display = findDisplay 313; private _GRID_H = pixelGrid * pixelH * 0.5; private _GRID_W = pixelGrid * pixelW * 0.5; // Function only works if slider and edit control share the same group private _ctrlGroup = _display ctrlCreate ["ctrlControlsGroupNoScrollbars", -100]; _ctrlGroup ctrlSetPosition [0, 0, 101 * _GRID_W, 5 * _GRID_H]; // Setup the slider private _ctrlSlider = _display ctrlCreate ["ctrlXSliderH", -101, _ctrlGroup]; _ctrlSlider ctrlSetPosition [0, 0, 50 * _GRID_W, 5 * _GRID_H]; _ctrlSlider sliderSetRange [100, 2000]; // Setup the edit control private _ctrlEdit = _display ctrlCreate ["ctrlEdit", -102, _ctrlGroup]; _ctrlEdit ctrlSetPosition [51 * _GRID_W, 0, 25 * _GRID_W, 5 * _GRID_H]; _ctrlSlider ctrlCommit 0; _ctrlEdit ctrlCommit 0; _ctrlGroup ctrlCommit 0; // Set default value [_ctrlSlider, _ctrlEdit, "m", 200] call BIS_fnc_initSliderValue; // Added eventhandlers to controls [_ctrlSlider, _ctrlEdit, "m"] call BIS_fnc_initSliderValue;

Additional Information

See also:
Eden Editor: Configuring Attributes

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note