ctrlSetScrollValues: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|seealso= *\[\[([^ ]+)\]\], \[\[([^ ]+)\]\]" to "|seealso= $1 $2")
m (Some wiki formatting)
 
(One intermediate revision by the same user not shown)
Line 6: Line 6:
|gr1= GUI Control
|gr1= GUI Control


|descr= Sets scroll values for current scrollbars in range 0...1 for the following controls:
|descr= Sets scroll values for current scrollbars in range 0..1 for the following controls:
 
{{Columns|2|
* {{hl|CT_CONTROLS_TABLE}}
* [[CT_CONTROLS_TABLE]]
* {{hl|CT_CONTROLS_GROUP}}
* [[CT_CONTROLS_GROUP]]
* {{hl|CT_TREE}}
* [[CT_TREE]]
* {{hl|CT_LISTBOX}}
* [[CT_LISTBOX]]
* {{hl|CT_COMBO}}
* [[CT_COMBO]]
* {{hl|CT_XCOMBO}}
* [[CT_XCOMBO]]
* {{hl|CT_LISTNBOX}}
* [[CT_LISTNBOX]]
* {{hl|CT_LISTNBOX_CHECKABLE}}
* [[CT_LISTNBOX_CHECKABLE]]
}}


|s1= control [[ctrlSetScrollValues]] [vScrollValue, hScrollValue]
|s1= control [[ctrlSetScrollValues]] [vScrollValue, hScrollValue]


|p1= control: [[Control]]
|p1= control: [[Control]]
|p2= [vScrollValue, hScrollValue]: [[Array]]
 
|p3= vScrollValue: [[Number]] - vertical scroll value in 0..1 range. -1 to skip
|p2= vScrollValue: [[Number]] - vertical scroll value in 0..1 range. -1 to skip
|p4= hScrollValue: [[Number]] - horizontal scroll value in 0..1 range. -1 to skip
 
|p3= hScrollValue: [[Number]] - horizontal scroll value in 0..1 range. -1 to skip
 
|r1= [[Nothing]]
|r1= [[Nothing]]


|x1= <code>_ctrlGrp [[ctrlSetScrollValues]] [-1, 0.5];</code>
|x1= <sqf>_ctrlGrp ctrlSetScrollValues [-1, 0.5];</sqf>


|x2= <code>// ControlsGroup
|x2= <sqf>
[[private]] _disp = [[findDisplay]] 46 [[createDisplay]] "RscDisplayEmpty";
// ControlsGroup
[[private]] _ctrlGrp = _disp [[ctrlCreate]] ["RscControlsGroup", -1];
private _disp = findDisplay 46 createDisplay "RscDisplayEmpty";
[[private]] _ctrl = _disp [[ctrlCreate]] ["RscTree", -1, _ctrlGrp];
private _ctrlGrp = _disp ctrlCreate ["RscControlsGroup", -1];
_ctrl [[tvAdd]] [<nowiki>[</nowiki>], "Root"];
private _ctrl = _disp ctrlCreate ["RscTree", -1, _ctrlGrp];
[[for]] "_i" [[from]] 1 [[to]] 25 [[do]]
_ctrl tvAdd [[], "Root"];
for "_i" from 1 to 25 do
{
{
_ctrl [[tvAdd]] [<nowiki>[</nowiki>0], [[format]] ["Tree Item %1", _i]];
_ctrl tvAdd [[0], format ["Tree Item %1", _i]];
};
};
_ctrl [[ctrlSetPosition]] [0,0,0.3,1.2];
_ctrl ctrlSetPosition [0,0,0.3,1.2];
_ctrl [[ctrlCommit]] 0;
_ctrl ctrlCommit 0;
[[tvExpandAll]] _ctrl;
tvExpandAll _ctrl;
_ctrlGrp [[ctrlSetPosition]] [0,0,0.2,0.3];
_ctrlGrp ctrlSetPosition [0,0,0.2,0.3];
_ctrlGrp [[ctrlCommit]] 0;
_ctrlGrp ctrlCommit 0;
   
   
[[uiNamespace]] [[setVariable]] ["_ctrl", _ctrlGrp];
uiNamespace setVariable ["_ctrl", _ctrlGrp];
[[onEachFrame]]
onEachFrame
{
{
[[hintSilent]] [[str]] [[ctrlScrollValues]] ([[uiNamespace]] [[getVariable]] ["_ctrl", [[controlNull]]]);
hintSilent str ctrlScrollValues (uiNamespace getVariable ["_ctrl", controlNull]);
};
};
[] [[spawn]]
0 spawn
{
{
[[sleep]] 1;
sleep 1;
[[uiNamespace]] [[getVariable]] ["_ctrl", [[controlNull]]] [[ctrlSetScrollValues]] [0.3, -1];
uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [0.3, -1];
[[sleep]] 1;
sleep 1;
[[uiNamespace]] [[getVariable]] ["_ctrl", [[controlNull]]] [[ctrlSetScrollValues]] [-1, 0.3];
uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [-1, 0.3];
[[sleep]] 1;
sleep 1;
[[uiNamespace]] [[getVariable]] ["_ctrl", [[controlNull]]] [[ctrlSetScrollValues]] [0.7, -1];
uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [0.7, -1];
[[sleep]] 1;
sleep 1;
[[uiNamespace]] [[getVariable]] ["_ctrl", [[controlNull]]] [[ctrlSetScrollValues]] [-1, 0.7];
uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [-1, 0.7];
};</code>
};
</sqf>


|seealso= [[ctrlScrollValues]] [[sliderSetPosition]] [[progressSetPosition]]
|seealso= [[ctrlScrollValues]] [[sliderSetPosition]] [[progressSetPosition]]
}}
}}

Latest revision as of 16:45, 17 April 2023

Hover & click on the images for description

Description

Description:
Sets scroll values for current scrollbars in range 0..1 for the following controls:
Groups:
GUI Control

Syntax

Syntax:
control ctrlSetScrollValues [vScrollValue, hScrollValue]
Parameters:
control: Control
vScrollValue: Number - vertical scroll value in 0..1 range. -1 to skip
hScrollValue: Number - horizontal scroll value in 0..1 range. -1 to skip
Return Value:
Nothing

Examples

Example 1:
_ctrlGrp ctrlSetScrollValues [-1, 0.5];
Example 2:
// ControlsGroup private _disp = findDisplay 46 createDisplay "RscDisplayEmpty"; private _ctrlGrp = _disp ctrlCreate ["RscControlsGroup", -1]; private _ctrl = _disp ctrlCreate ["RscTree", -1, _ctrlGrp]; _ctrl tvAdd [[], "Root"]; for "_i" from 1 to 25 do { _ctrl tvAdd [[0], format ["Tree Item %1", _i]]; }; _ctrl ctrlSetPosition [0,0,0.3,1.2]; _ctrl ctrlCommit 0; tvExpandAll _ctrl; _ctrlGrp ctrlSetPosition [0,0,0.2,0.3]; _ctrlGrp ctrlCommit 0; uiNamespace setVariable ["_ctrl", _ctrlGrp]; onEachFrame { hintSilent str ctrlScrollValues (uiNamespace getVariable ["_ctrl", controlNull]); }; 0 spawn { sleep 1; uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [0.3, -1]; sleep 1; uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [-1, 0.3]; sleep 1; uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [0.7, -1]; sleep 1; uiNamespace getVariable ["_ctrl", controlNull] ctrlSetScrollValues [-1, 0.7]; };

Additional Information

See also:
ctrlScrollValues sliderSetPosition progressSetPosition

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