OFPEC Forum

Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: UH60MG on 21 Feb 2008, 17:00:29

Title: Sliders
Post by: UH60MG on 21 Feb 2008, 17:00:29
How do I get a slider to appear in ArmA?

Here is the code in the description I tried...

Quote
#define FontM "Zeppelin32"
#define FontHTML "Zeppelin32"

#define ST_LEFT       0
#define ST_RIGHT      1
#define ST_CENTER     2
#define ST_FRAME      64

#define CT_STATIC     0
#define CT_BUTTON     1
#define CT_SLIDER     3

#define CT_COMBO      4
#define CT_LISTBOX    5

#define SL_DIR            0x400
#define SL_VERT           0
#define SL_HORZ           0x400



class RscText
{
        type = CT_STATIC;
        idc = -1;
        style = ST_LEFT;
        colorBackground[] = {0, 0, 0, 0};
        colorText[] = {0, 0, 0, 1};
        font = FontM;
        sizeEx = 0.025;
};

class RscSliderH
{
       type = CT_SLIDER;
       style = ST_LEFT;
       color[] = {0.2, 0.2, 0.2, 1};
       idc = -1;
       sizeEx = 0.025;
};


class DlgStart
{
  idd = -1;
  movingEnable = true;

  objects[] = { };
  controls[] = { MY_SLIDER};


  class MY_SLIDER : RscSliderH
  {
     idc = 204;
     x = 0.25;
     y = 0.3;
     w = 0.5;
     h = 0.04;
  };

};

This doesn't show a slider. What am I doing wrong?
Title: Re: Sliders
Post by: Mandoble on 21 Feb 2008, 17:10:40
Code: [Select]
  style = ST_LEFT; ----> style = 1024;
Title: Re: Sliders
Post by: UH60MG on 21 Feb 2008, 17:37:39
Thanks.

And how do I read the current position of the slider?


I tried this in  a script but it doesn't work (displays '0' no matter what)

titleText [format ["%1", sliderPosition 204], "PLAIN", 2]
Title: Re: Sliders
Post by: h- on 21 Feb 2008, 18:28:37
Just informing, moved this here since this is where the dialog stuff should even if it might not feel advanced for some. :)
Title: Re: Sliders
Post by: Mandoble on 21 Mar 2008, 11:30:14
First you need to give the slider its range and "speeds":

_myslidercontrol sliderSetRange [0, 359];
_myslidercontrol sliderSetSpeed [1, 10];

For example, then you will be able to read the position.