DialogControls-Sliders: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Added sliderPosition, sliderRange and sliderStep attributes)
m (visual tweaks)
Line 1: Line 1:
{{SideTOC}}
==General==
==General==
*'''TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.'''
{{Informative|TokenNames common to most controls, such as x, y, w, h, text, idc... are not listed here.}}
 
*'Sliders' and 'ScrollBars' are synonymous.
*'Sliders' and 'ScrollBars' are synonymous.
*Default scrollbars (sliders) are VERTICAL. Use ST_HORZ to change orientation.
*Default scrollbars are vertical. Use ST_HORZ to change orientation.
*Embedded child scrollbars are created by the engine as and when required for various control types. (CT_LISTBOX eg). The engine generates it's own idc for them. In most cases you can alter characteristics of that auto-generated scrollbar via class ScrollBar
*Embedded child scrollbars are created by the engine as and when required for various control types. (CT_LISTBOX eg). The engine generates it's own idc for them. In most cases you can alter characteristics of that auto-generated scrollbar via class ScrollBar
{{Important|It makes no sense to create 'independent' scrollbars without an idc.}}


It makes no sense to create 'independent' scrollbars without an idc.
==CT_SLIDER=3 (deprecated)==
==CT_SLIDER=3 (deprecated)==
{| border="1" align="left" cellpadding="3" cellspacing="0" |
{|class="wikitable" width="40%" border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="3" bgcolor="#bbbbff" | Properties
|-
|-
Line 28: Line 30:
Embedded scrollbar classes (such as those in listboxes eg) use the xbox properties as per a CT_XSLIDER
Embedded scrollbar classes (such as those in listboxes eg) use the xbox properties as per a CT_XSLIDER


{| border="1" align="left" cellpadding="3" cellspacing="0" |
{|class="wikitable" width="40%" border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="3" bgcolor="#bbbbff" | Properties
|-
|-
Line 64: Line 66:
|-
|-
|}<br clear="all">
|}<br clear="all">


====Title or Value class====
====Title or Value class====
{| border="1" align="left" cellpadding="3" cellspacing="0" |
{|class="wikitable" border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="3" bgcolor="#bbbbff" | Properties
|-
|-
Line 88: Line 88:
|-
|-
|}<br clear="all">
|}<br clear="all">
==Example==


[[Image:ControlSlider.JPG|thumb|200px|A Slider Control]]
[[Image:ControlSlider.JPG|thumb|200px|A Slider Control]]
* '''Example:'''
* '''Example Config:'''
<code><nowiki>class MySlider {
<syntaxhighlight lang="cpp">class MySlider  
    idc = -1;  
{
    type = CT_SLIDER;  
  idc = -1;  
    style = SL_HORZ;  
  type = CT_SLIDER;  
    x = 0.4;  
  style = SL_HORZ;  
    y = 0.2;  
  x = 0.4;  
    w = 0.3;  
  y = 0.2;  
    h = 0.025;  
  w = 0.3;  
    color[] = { 1, 1, 1, 1 };  
  h = 0.025;  
    coloractive[] = { 1, 0, 0, 0.5 };
  color[] = { 1, 1, 1, 1 };  
    // This is an ctrlEventHandler to show you some response if you move the sliderpointer.
  coloractive[] = { 1, 0, 0, 0.5 };
    onSliderPosChanged = "hint format[""%1"",_this];";
  // This is an ctrlEventHandler to show you some response if you move the sliderpointer.
    sliderPosition = 500;//Initial position when slider is created
  onSliderPosChanged = "hint format[""%1"",_this];";
sliderRange[] = {50,2000};//Min and max value of the slider
  sliderPosition = 500;//Initial position when slider is created
sliderStep = 1;//Size of step when dragging
  sliderRange[] = {50,2000};//Min and max value of the slider
};</nowiki></code>
  sliderStep = 1;//Size of step when dragging
* '''Helpful Script Commands:'''
};</syntaxhighlight>
=Helpful Script Commands=
'''[[sliderPosition]], [[sliderRange]], [[sliderSetPosition]], [[sliderSetRange]], [[sliderSetSpeed]], [[sliderSpeed]]'''
'''[[sliderPosition]], [[sliderRange]], [[sliderSetPosition]], [[sliderSetRange]], [[sliderSetSpeed]], [[sliderSpeed]]'''
[[Category: Dialogs]]
[[Category: Dialogs]]

Revision as of 20:18, 18 February 2020

Template:SideTOC

General

TokenNames common to most controls, such as x, y, w, h, text, idc... are not listed here.
  • 'Sliders' and 'ScrollBars' are synonymous.
  • Default scrollbars are vertical. Use ST_HORZ to change orientation.
  • Embedded child scrollbars are created by the engine as and when required for various control types. (CT_LISTBOX eg). The engine generates it's own idc for them. In most cases you can alter characteristics of that auto-generated scrollbar via class ScrollBar
It makes no sense to create 'independent' scrollbars without an idc.

CT_SLIDER=3 (deprecated)

Properties
Name Type Remark
coloractive color array color of the arrows.
Title/Value classes Optional and probably script only related


CT_XSLIDER=43 or Embedded Scrollbar Class

Embedded scrollbar classes (such as those in listboxes eg) use the xbox properties as per a CT_XSLIDER

Properties
Name Type Remark
arrowEmpty/Full textures
border texture
colorActive color color of the arrows.
colorDisabled color
thumb texture
vspacing float
Title/Value classes Optional probably irrelevant as script only related


Title or Value class

Properties
Name Type Remark
idc integer
colorBase color array
colorActive color array


A Slider Control
  • Example Config:
class MySlider 
{
  idc = -1; 
  type = CT_SLIDER; 
  style = SL_HORZ; 
  x = 0.4; 
  y = 0.2; 
  w = 0.3; 
  h = 0.025; 
  color[] = { 1, 1, 1, 1 }; 
  coloractive[] = { 1, 0, 0, 0.5 };
  // This is an ctrlEventHandler to show you some response if you move the sliderpointer.
  onSliderPosChanged = "hint format[""%1"",_this];";
  sliderPosition = 500;//Initial position when slider is created
  sliderRange[] = {50,2000};//Min and max value of the slider
  sliderStep = 1;//Size of step when dragging
};

Helpful Script Commands

sliderPosition, sliderRange, sliderSetPosition, sliderSetRange, sliderSetSpeed, sliderSpeed