{"name":"BIS_fnc_initSliderValue","title":"BIS fnc initSliderValue","type":"function","url":"https://community.bistudio.com/wiki/BIS_fnc_initSliderValue","revid":352075,"updated":"2024-02-01T23:24:42Z","groups":["Eden Editor"],"status":"ok","games":{"arma3":"1.58"},"since":"arma3 1.58","arma3_since":"1.58","description":"Initialises a slider attribute control within the Eden Editor. Can also be used outside of Eden Editor.\n\n> [!NOTE]\n> The slider and the edit control have to share the same controls group!","syntaxes":[{"syntax":"[ctrlSlider, ctrlEdit, unit, default] call BIS_fnc_initSliderValue","params":[{"name":"ctrlSlider","type":"Control","description":"slider control, usually the first control within the controls group","type_expr":"Control"},{"name":"ctrlEdit","type":"Control","description":"edit Box, usually the second control within the controls group","type_expr":"Control"},{"name":"unit","type":"String","description":"measurement unit added behind the number within the edit box (\"%\" by default)","type_expr":"String"},{"name":"default","type":"Number","description":"when present, only the value is set, functionality is not initialized","type_expr":"Number"}],"returns":{"type":"Nothing","type_expr":"Nothing"}}],"examples":[{"code":["[_this controlsGroupCtrl 100, _this controlsGroupCtrl 101, \"m\", 50] call BIS_fnc_initSliderValue;"]},{"code":["// Execute in Eden Editor to preview the functionality\nif !(is3DEN) exitWith {};\n\nprivate _display = findDisplay 313;\nprivate _GRID_H = pixelGrid * pixelH * 0.5;\nprivate _GRID_W = pixelGrid * pixelW * 0.5;\n\n// Function only works if slider and edit control share the same group\nprivate _ctrlGroup = _display ctrlCreate [\"ctrlControlsGroupNoScrollbars\", -100];\n_ctrlGroup ctrlSetPosition [0, 0, 101 * _GRID_W, 5 * _GRID_H];\n\n// Setup the slider\nprivate _ctrlSlider = _display ctrlCreate [\"ctrlXSliderH\", -101, _ctrlGroup];\n_ctrlSlider ctrlSetPosition [0, 0, 50 * _GRID_W, 5 * _GRID_H];\n_ctrlSlider sliderSetRange [100, 2000];\n\n// Setup the edit control\nprivate _ctrlEdit = _display ctrlCreate [\"ctrlEdit\", -102, _ctrlGroup];\n_ctrlEdit ctrlSetPosition [51 * _GRID_W, 0, 25 * _GRID_W, 5 * _GRID_H];\n\n_ctrlSlider ctrlCommit 0;\n_ctrlEdit ctrlCommit 0;\n_ctrlGroup ctrlCommit 0;\n\n// Set default value\n[_ctrlSlider, _ctrlEdit, \"m\", 200] call BIS_fnc_initSliderValue;\n\n// Added eventhandlers to controls\n[_ctrlSlider, _ctrlEdit, \"m\"] call BIS_fnc_initSliderValue;"]}],"see_also":["Eden Editor: Configuring Attributes"]}