Jump to content
Sign in to follow this  
lawman_actual

Dynamic numbered Rsc Slider

Recommended Posts

Greetings

 

I'm creating a GUI for calling support/fire missions and I have a field for selecting the number of rounds fired in artillery or air strikes.

 

Previously this was a simple combo box, but it would look a lot better if this was a slider* (I haven't yet figured out how to upload a picture on here)

 

 

I've successfully created a default slider, but I haven't yet found out how to set the number of 'ticks', or what these correspond to.

 

 

For example;

 

  • Suppose you choose MLRS from a combo; I would want five increments on the scale corresponding to: [1,2,4,8,12];
  • If you chose an air strike using Hydra 70 rockets however, I would only want three increments, corresponding to [7,14,28];

 

There are some examples I only want 1 option (i.e. with a 1000lb JDAM strike), but I guess I can 'grey out' the slider and make it have no effect in these cases.

 

 

Thanks in advance,

Lawman

 

 

 

*I'm assuming here that a slider is a scale of options, rather than a scroll bar. Although weirdly the biki suggests that "slider" and "scroll bar" are synonymous, even though to me the rscSlider looks more like a way of selecting a scale of options

Share this post


Link to post
Share on other sites

Other points:

 

- How might I go about 'hiding' the slider in cases where it's not relevant?

 

- How can I change the value of an rscText control when the slider is set to certain values?

Share this post


Link to post
Share on other sites

You should familiarize yourself with User Interface Event Handlers, there is an event handler that's exactly what you need, onSliderPosChanged. To use a UI event handler, you need to define it in the control:

class RscSlider_2000: RscSlider
{
	idc = 2000;
	
	x = 0 * safezoneW + safezoneX;
	y = 0 * safezoneH + safezoneY;
	w = 1 * safezoneW;
	h = 1 * safezoneH;
	
	onMouseClick = "systemChat str _this;";
	onMouseMoving = "systemChat str _this;";

	onSliderPosChanged = "call myFunction;";
};

In the function you call when the event handler fires, a simple switch will be sufficient. To change the text of a control, you need to familiarize yourself with this page, ctrlSetText is the command you are looking for. To hide a control, ctrlShow.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×