DialogControls-ControlsGroup: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(Added additional info. Outlined what is available for each scrollbar Vertical/Horizontal.)
(One intermediate revision by one other user not shown)
Line 2: Line 2:
TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.
TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.


*The x and y coords of the child control are relative to the parent class, the height and width are not
*Any child controls need to be defined in the controlsGroup's subclass Controls {};
*If the height and / or width of the child control are greater than the parent control then scrollbars will be seen
*The x and y coords of any child controls are relative to the controlsGroups position. The height and width are not and are in [[GUI_Coordinates|screen space dimensions]].
*If the position or height/width of any child controls cause any part of the child control to fall outside the dimensions of the controlsGroup then scrollbars will be seen
**This allows the creation of scrollable active text controls etc
**This allows the creation of scrollable active text controls etc
*The entire child class needs to be defined in the parents subclass class Controls {};
<br/>
{| border="1" align="left" cellpadding="3" cellspacing="0" |
{| border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="3" bgcolor="#bbbbff" | Properties
Line 12: Line 13:
! bgcolor="#ddddff" | Type
! bgcolor="#ddddff" | Type
! bgcolor="#ddddff" | Remark
! bgcolor="#ddddff" | Remark
|-
| '''ScrollBar'''
| class
| Default parent class for all scrollbar settings
|-
|-
| '''VScrollbar'''
| '''VScrollbar'''
| class
| class
|  
| Settings relating to Vertical scrollbar
|-
|-
| '''HScrollbar'''
| '''HScrollbar'''
| class
| class
|  
| Settings relating to Horizontal scrollbar
|-
| '''ScrollBar'''
| class
|
|-
|-
| '''Controls'''
| '''Controls'''
| class
| class
|  
| Any user added [[Dialog_Control#Controls|controls]] to be contained within the controlsGroup
|-
|-
|}<br clear="all">
|}<br clear="all">
 
<br/>
===class VScrollbar===
===class Scrollbar===
 
Parent class used to define all available properties of '''VScrollbar''' and '''HScrollbar'''. Not all available properties make sense for each of these as outlined below.
{| border="1" align="left" cellpadding="3" cellspacing="0" |
{| border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="3" bgcolor="#bbbbff" | Properties
Line 40: Line 41:
! bgcolor="#ddddff" | Remark
! bgcolor="#ddddff" | Remark
|-
|-
| '''autoScrollSpeed'
| '''color'''
| integer
| [[Color|color array]]
| typically -1
| color of thumb and arrow heads, also arrow backgrounds when pressed
|-
| '''colorActive'''
| [[Color|color array]]
|
|-
| '''colorDisabled'''
| [[Color|color array]]
|
|-
| '''width/height'''
| [[Number]]
| width/height of the controlsGroup's scroll bars  in [[GUI_Coordinates|screen space dimensions]]. Setting to 0 will cause no scrollbar to be shown even if a child falls outside the controlsGroup's dimensions
|-
| '''autoScrollEnabled'''
| [[Number]]
| 1 - enabled, 0 - disabled, Does not work if there a interactive controls within the controlsGroup e.g Buttons
|-
| '''autoScrollSpeed'''
| [[Number]]
| default -1, smaller numbers scroll faster, '''cannot''' be forced to scroll backwards by supplying negative numbers
|-
|-
| '''autoScrollDelay'''
| '''autoScrollDelay'''
| integer
| [[Number]]
| in seconds
| time in seconds before autoScroll starts, restarts after user input and time before rewind happens when the end has been reached
|-
| '''autoScrollRewind'''
| [[Number]]
| 0 - disable, 1 - enabled : If autoScroll reaches the bottom of the controlsGroup it will wait '''autoScrollDelay''' then fade out, scroll back to the top, fade back in, wait '''autoScrollDelay''' before proceeding to start auto scrolling again.
|-
| '''thumb'''
| [[String]]
| path to texture or [[Procedural_Textures#color|Procedural Texture]] "#(argb,8,8,3)color(1,1,1,1)";
|-
|-
| '''autoScrollRewind'
| '''arrowEmpty/Full'''
| boolean
| [[String]]
|
| path to texture or [[Procedural_Textures#color|Procedural Texture]] "#(argb,8,8,3)color(1,1,1,1)";
|-
|-
| '''color'''
| '''border'''
| color array
| [[String]]
|
| path to texture or [[Procedural_Textures#color|Procedural Texture]] "#(argb,8,8,3)color(1,1,1,1)";
|-
|-
| '''shadow'''
| '''shadow'''
| integer
| [[Number]]
|
|  
|-
|-
| '''width'''
| '''scrollSpeed'''
| float
| [[Number]]
|
| default 0.06 : Speed of user vertical scroll input when using the mouse wheel, can be set to 0 to disable the user from being able to scroll, can be set to negative number to reverse scroll direction.
|-
|-
|}<br clear="all">
|}<br clear="all">
===class HScrollbar===
===class VScrollbar===
{| border="1" align="left" cellpadding="3" cellspacing="0" |
{| border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="1" bgcolor="#bbbbff" | Properties
|-
|-
! bgcolor="#ddddff" | Name
! bgcolor="#ddddff" | Name
! bgcolor="#ddddff" | Type
! bgcolor="#ddddff" | Remark
|-
|-
| '''color'''
| '''color'''
| color array
|
|-
|-
| '''height'''
| '''colorActive'''
| float
|-
|
| '''colorDisabled'''
|-
| '''width'''
|-
| '''autoScrollEnabled'''
|-
| '''autoScrollSpeed'''
|-
| '''autoScrollDelay'''
|-
| '''autoScrollRewind'''
|-
| '''thumb'''
|-
| '''arrowEmpty/Full'''
|-
| '''border'''
|-
|-
| '''shadow'''
| '''shadow'''
| integer
|-
|
| '''scrollSpeed'''
|-
|-
|}<br clear="all">
|}<br clear="all">
===class Scrollbar===
===class HScrollbar===
{| border="1" align="left" cellpadding="3" cellspacing="0" |
{| border="1" align="left" cellpadding="3" cellspacing="0" |
! colspan="3" bgcolor="#bbbbff" | Properties
! colspan="1" bgcolor="#bbbbff" | Properties
|-
|-
! bgcolor="#ddddff" | Name
! bgcolor="#ddddff" | Name
! bgcolor="#ddddff" | Type
! bgcolor="#ddddff" | Remark
|-
|-
| '''color'''
| '''color'''
| color array
|
|-
|-
| '''colorActive'''
| '''colorActive'''
| color array
|
|-
|-
| '''colorDisabled'''
| '''colorDisabled'''
| color array
|-
|
| '''height'''
|-
|-
| '''thumb'''
| '''thumb'''
| string
| path to texture or "#(argb,8,8,3)color(1,1,1,1)";
|-
|-
| '''arrowEmpty/Full'''
| '''arrowEmpty/Full'''
| string
| path to texture or "#(argb,8,8,3)color(1,1,1,1)";
|-
|-
| '''border'''
| '''border'''
| string
|-
| path to texture or "#(argb,8,8,3)color(1,1,1,1)";
| '''shadow'''
|-
|-
|}<br clear="all">
|}<br clear="all">
===class Controls===
===class Controls===
*additional user added controls of any type can be added in a derived class. the base is empty because the engine looks for it regardless.
*additional user added controls of any type can be added in a derived class. the base is empty because the engine looks for it regardless.
Line 124: Line 156:
==Example==
==Example==


In this example, the child control My_RscStructuredText is higher (h value) than the parent control, so a vertical scrollbar is automatically created, which allows scrolling the entire length of the structured text display
*In this example, the child control My_RscStructuredText is higher (h value) than the parent control, so a vertical scrollbar is automatically created, which allows scrolling the entire length of the structured text display
 
*A generalised screw-up occurs in Arrowhead rscControlGroup where color is not specified for V and H scrollbars and shadow should not have been specified. As a result any deriving class a) cannot inherit the existing scrollbar, and b) must repeat the entire thing with the addition of color.
 
<code><nowiki>
<code><nowiki>
class RscControlsGroup   
class RscControlsGroup   

Revision as of 21:50, 22 July 2017

CT_CONTROLS_GROUP Type=15

TokenNames common to most controls, such as x,y,w,h,text,idc... are not listed here.

  • Any child controls need to be defined in the controlsGroup's subclass Controls {};
  • The x and y coords of any child controls are relative to the controlsGroups position. The height and width are not and are in screen space dimensions.
  • If the position or height/width of any child controls cause any part of the child control to fall outside the dimensions of the controlsGroup then scrollbars will be seen
    • This allows the creation of scrollable active text controls etc


Properties
Name Type Remark
ScrollBar class Default parent class for all scrollbar settings
VScrollbar class Settings relating to Vertical scrollbar
HScrollbar class Settings relating to Horizontal scrollbar
Controls class Any user added controls to be contained within the controlsGroup



class Scrollbar

Parent class used to define all available properties of VScrollbar and HScrollbar. Not all available properties make sense for each of these as outlined below.

Properties
Name Type Remark
color color array color of thumb and arrow heads, also arrow backgrounds when pressed
colorActive color array
colorDisabled color array
width/height Number width/height of the controlsGroup's scroll bars in screen space dimensions. Setting to 0 will cause no scrollbar to be shown even if a child falls outside the controlsGroup's dimensions
autoScrollEnabled Number 1 - enabled, 0 - disabled, Does not work if there a interactive controls within the controlsGroup e.g Buttons
autoScrollSpeed Number default -1, smaller numbers scroll faster, cannot be forced to scroll backwards by supplying negative numbers
autoScrollDelay Number time in seconds before autoScroll starts, restarts after user input and time before rewind happens when the end has been reached
autoScrollRewind Number 0 - disable, 1 - enabled : If autoScroll reaches the bottom of the controlsGroup it will wait autoScrollDelay then fade out, scroll back to the top, fade back in, wait autoScrollDelay before proceeding to start auto scrolling again.
thumb String path to texture or Procedural Texture "#(argb,8,8,3)color(1,1,1,1)";
arrowEmpty/Full String path to texture or Procedural Texture "#(argb,8,8,3)color(1,1,1,1)";
border String path to texture or Procedural Texture "#(argb,8,8,3)color(1,1,1,1)";
shadow Number
scrollSpeed Number default 0.06 : Speed of user vertical scroll input when using the mouse wheel, can be set to 0 to disable the user from being able to scroll, can be set to negative number to reverse scroll direction.


class VScrollbar

Properties
Name
color
colorActive
colorDisabled
width
autoScrollEnabled
autoScrollSpeed
autoScrollDelay
autoScrollRewind
thumb
arrowEmpty/Full
border
shadow
scrollSpeed


class HScrollbar

Properties
Name
color
colorActive
colorDisabled
height
thumb
arrowEmpty/Full
border
shadow


class Controls

  • additional user added controls of any type can be added in a derived class. the base is empty because the engine looks for it regardless.

Example

  • In this example, the child control My_RscStructuredText is higher (h value) than the parent control, so a vertical scrollbar is automatically created, which allows scrolling the entire length of the structured text display
  • A generalised screw-up occurs in Arrowhead rscControlGroup where color is not specified for V and H scrollbars and shadow should not have been specified. As a result any deriving class a) cannot inherit the existing scrollbar, and b) must repeat the entire thing with the addition of color.

class RscControlsGroup { type = CT_CONTROLS_GROUP; idc = -1; style = ST_MULTI; x = 0; y = 0; w = 1; h = 1; shadow=0; class VScrollbar { width = 0.021; autoScrollSpeed = -1; autoScrollDelay = 5; autoScrollRewind = 0; shadow=0; }; class HScrollbar { height = 0.028; shadow=0; }; class ScrollBar { color[] = {1,1,1,0.6}; colorActive[] = {1,1,1,1}; colorDisabled[] = {1,1,1,0.3}; thumb = "#(argb,8,8,3)color(1,1,1,1)"; arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)"; arrowFull = "#(argb,8,8,3)color(1,1,1,1)"; border = "#(argb,8,8,3)color(1,1,1,1)"; }; class Controls{};// an empty class telling the engine, no custom, additional controls }; class dialog { class controls { class MyControls:RscControlsGroup { x = (safeZoneX + (SafezoneW * 0.0363)); // scalability code which resizes correctly no matter what gui size or screen dimensions is used y = (safeZoneY + (SafezoneH * 0.132)); // scalability code which resizes correctly no matter what gui size or screen dimensions is used w = (SafezoneW * 0.31); // scalability code which resizes correctly no matter what gui size or screen dimensions is used h = (SafezoneH * 0.752); // scalability code which resizes correctly no matter what gui size or screen dimensions is used class Controls { ...class whatever additional controls you want }; }; }; };