Jump to content
dlder

Tooltip with value of slider?

Recommended Posts

Hi there!

 

I've created a slider to set the skill of recruited units and it works as intended.

 

BUT: I'd like to display the current skill level from the slider as it's tooltip:

https://steamcommunity.com/sharedfiles/filedetails/?id=2382225926

 

Current code:

		class SkillSlider {
			idc = Hotshot_RECRUITING_SKILL;
			type = CT_XSLIDER;
			style = "0x400 + 0x10";

			x = 0.11; y = 0.73;
			w = 0.389; h = 0.05;
			
			sliderPosition = 50;
			sliderRange[] = {10, 100};
			sliderStep = 10;
			
			color[] = {1, 1, 1, 1};
			colorActive[] = {1, 1, 1, 1};
			tooltipColorText[] = {1, 1, 1, 1};
			tooltipColorBox[] = {0, 0, 0, 1};
			tooltipColorShade[] = {0, 0, 0, 0.75};
			
			//tooltip = "Skill";
			_testvar = 10;
			tooltip = format ["Skill: %1", _testvar];
			
			arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
			arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
			border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
			thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";
		};

Oh, and why don't the arrows work? I can only use the slider itself to move it... sliderSetSpeed has two values for that, but in the class (sliderStep) I can only use one number!?

 

Cheers and thanks!

Share this post


Link to post
Share on other sites

Use onSliderPosChanged to get update  everytime user moves the slider

 

like:

class SkillSlider
{

 onSliderPosChanged = "   params ['_control', '_newValue'];  hint 'slider moving!'; ";

};

 

to get the arrows showing try   style = 0; 

 

the default scrollbar values are kinda bad

 

 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks; what I did manage was to display the set skill level into the chat area:

onSliderPosChanged = " params ['_control', '_newValue']; systemchat format ['Set skill = %1', _this select 1]; ";

But setting the tooltip of the control doesn't seem to work (this way at least):

onSliderPosChanged = " params ['_control', '_newValue']; _Text = format ['Set skill = %1', _this select 1]; 20006 ctrlSetTooltip _Text;";

20006 = idc of the slider

Share this post


Link to post
Share on other sites
1 hour ago, dlder said:

But setting the tooltip of the control doesn't seem to work (this way at least):


onSliderPosChanged = " params ['_control', '_newValue']; _Text = format ['Set skill = %1', _this select 1]; 20006 ctrlSetTooltip _Text;";

20006 = idc of the slider

 

the ctrlSetTooltip command needs control as first parameter, not number. you can get that by using displayCtrl

  • Like 1

Share this post


Link to post
Share on other sites

Thanks; I already got it (should've refreshed this page^^)

onSliderPosChanged = " params ['_control', '_newValue']; _ctrl = _this select 0; _ctrl ctrlSetTooltip format ['Skill set to: %1%2', _this select 1, '%'];";

Thanks for your help!

  • Like 1

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

×