{"name":"BIS_fnc_initSliderValue","operator":null,"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","replaced_by":[],"games":[{"game":"arma3","name":"Arma 3","version":"1.58"}],"since":{"game":"arma3","name":"Arma 3","version":"1.58"},"arma3_since":"1.58","branch":null,"locality":{"argument":null,"effect":null,"server_exec":false},"exec":null,"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","since":null,"effect":null,"exec":null,"params":[{"name":"ctrlSlider","type":"Control","optional":false,"default":null,"description":"slider control, usually the first control within the controls group","types":["Control"],"since":null,"text":"ctrlSlider: Control - slider control, usually the first control within the controls group"},{"name":"ctrlEdit","type":"Control","optional":false,"default":null,"description":"edit Box, usually the second control within the controls group","types":["Control"],"since":null,"text":"ctrlEdit: Control - edit Box, usually the second control within the controls group"},{"name":"unit","type":"String","optional":false,"default":null,"description":"measurement unit added behind the number within the edit box (\"%\" by default)","types":["String"],"since":null,"text":"unit: String - measurement unit added behind the number within the edit box (\"%\" by default)"},{"name":"default","type":"Number","optional":false,"default":null,"description":"when present, only the value is set, functionality is not initialized","types":["Number"],"since":null,"text":"default: Number - when present, only the value is set, functionality is not initialized"}],"returns":{"type":"Nothing","types":["Nothing"],"description":null,"text":"Nothing"}}],"examples":[{"text":"```sqf\n[_this controlsGroupCtrl 100, _this controlsGroupCtrl 101, \"m\", 50] call BIS_fnc_initSliderValue;\n```","code":["[_this controlsGroupCtrl 100, _this controlsGroupCtrl 101, \"m\", 50] call BIS_fnc_initSliderValue;"]},{"text":"```sqf\n// 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;\n```","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;"]}],"multiplayer":null,"problems":null,"aliases":[],"see_also":["Eden Editor: Configuring Attributes"],"notes":[],"categories":["Arma 3: Functions","Arma 3: New Functions","Function Group: Eden Editor","Functions","Introduced with Arma 3 version 1.58"],"docblock":null,"filled_from_docblock":[]}