samir17864 44 Posted July 16, 2023 Hello everyone, I am trying to add a special type of slider to a GUI dialog similar to the time slider in Edit Environment in Eden Editorhttps://pmc.editing.wiki/images/ArmA-3-Eden-Editor-Environment.png I have the dialog with many controls already added to it, but I don't know how to add that special type of time slider. I hope someone can guide me how to do that. Share this post Link to post Share on other sites
dupa1 8 Posted July 16, 2023 I don't really know the answer, but I suspect it could be just a normal slider with an image on top of it. Share this post Link to post Share on other sites
Larrow 2822 Posted July 16, 2023 3 hours ago, dupa1 said: but I suspect it could be just a normal slider with an image on top of it. this. You can always look inside the config\extracted files to see how it is done. Spoiler class ctrlDefault { access=0; idc=-1; style=0; default=0; show=1; fade=0; blinkingPeriod=0; deletable=0; x=0; y=0; w=0; h=0; tooltip=""; tooltipMaxWidth=0.5; tooltipColorShade[]={0,0,0,1}; tooltipColorText[]={1,1,1,1}; tooltipColorBox[]={0,0,0,0}; class ScrollBar { width=0; height=0; scrollSpeed=0.059999999; arrowEmpty="\a3\3DEN\Data\Controls\ctrlDefault\arrowEmpty_ca.paa"; arrowFull="\a3\3DEN\Data\Controls\ctrlDefault\arrowFull_ca.paa"; border="\a3\3DEN\Data\Controls\ctrlDefault\border_ca.paa"; thumb="\a3\3DEN\Data\Controls\ctrlDefault\thumb_ca.paa"; color[]={1,1,1,1}; }; }; class ctrlXSliderV: ctrlDefault { type=43; style=0; color[]={1,1,1,0.60000002}; colorActive[]={1,1,1,1}; colorDisabled[]={1,1,1,0.25}; sliderRange[]={0,1}; sliderPosition=1; lineSize=0.1; arrowEmpty="\a3\3DEN\Data\Controls\CtrlXSlider\arrowEmpty_ca.paa"; arrowFull="\a3\3DEN\Data\Controls\CtrlXSlider\arrowFull_ca.paa"; border="\a3\3DEN\Data\Controls\CtrlXSlider\border_ca.paa"; thumb="\a3\3DEN\Data\Controls\CtrlXSlider\thumb_ca.paa"; class Title { idc=-1; colorBase[]={1,1,1,1}; colorActive[]= { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])", 1 }; }; class Value { idc=-1; format="%.f"; type="SPTPlain"; colorBase[]={1,1,1,1}; colorActive[]= { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])", 1 }; }; onCanDestroy=""; onDestroy=""; onSetFocus=""; onKillFocus=""; onKeyDown=""; onKeyUp=""; onMouseButtonDown=""; onMouseButtonUp=""; onMouseButtonClick=""; onMouseButtonDblClick=""; onMouseZChanged=""; onMouseMoving=""; onMouseHolding=""; onSliderPosChanged=""; }; class ctrlXSliderH: ctrlXSliderV { style=1024; }; class SliderTime: Title { attributeLoad=" (_this controlsGroupCtrl 100) slidersetposition _value; [_this controlsGroupCtrl 100,_value] call compile gettext (configfile >> 'Cfg3DEN' >> 'Attributes' >> 'SliderTime' >> 'Controls' >> 'Value' >> 'onSliderPosChanged'); "; attributeSave=" sliderposition (_this controlsGroupCtrl 100) "; class Controls: Controls { class Title: Title { }; class Value: ctrlXSliderH { idc=100; x="48 * (pixelW * pixelGrid * 0.50)"; w="( 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; sliderRange[]={0,3600}; sliderPosition=0; pageSize=1; onSliderPosChanged=" comment 'DO NOT COPY THIS CODE TO YOUR ATTRIBUTE CONFIG UNLESS YOU ARE CHANGING SOMETHING IN THE CODE!'; _ctrlSlider = _this select 0; _value = (_this select 1) * (sliderspeed _ctrlSlider select 1); _valueHour = floor (_value / 3600); _valueMinute = floor ((_value / 60) % 60); _valueSecond = floor (_value % 60); _textHour = if (_valueHour < 10) then {'0' + str _valueHour} else {str _valueHour}; _textMinute = if (_valueMinute < 10) then {'0' + str _valueMinute} else {str _valueMinute}; _textSecond = if (_valueSecond < 10) then {'0' + str _valueSecond} else {str _valueSecond}; _ctrlGroup = ctrlParentControlsGroup _ctrlSlider; _ctrlHour = _ctrlGroup controlsgroupctrl 101; _ctrlMinute = _ctrlGroup controlsgroupctrl 102; _ctrlSecond = _ctrlGroup controlsgroupctrl 103; _ctrlHour ctrlsettext _textHour; _ctrlMinute ctrlsettext _textMinute; _ctrlSecond ctrlsettext _textSecond; _ctrlCfg = configfile >> 'Cfg3DEN' >> 'Attributes' >> ctrlclassname _ctrlGroup; _code = gettext (_ctrlCfg >> 'onValueChanged'); if (_code != '') then {[_ctrlGroup,_value] call compile _code;}; "; }; class Frame: ctrlStaticFrame { x="( 48 + 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; w="3 * 8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; class Separator: ctrlStatic { style=2; x="( 48 + 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; w="3 * 8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; font="EtelkaMonospacePro"; sizeEx="3.875 * (1 / (getResolution select 3)) * pixelGrid * 0.5"; colorBackground[]={0,0,0,0.5}; text=": :"; }; class Hour: ctrlEdit { idc=101; text="00"; tooltip="$STR_3DEN_Attributes_SliderTime_Hour_tooltip"; style="0x02 + 0x200"; x="( 48 + 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; w="8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; colorBackground[]={0,0,0,0}; font="EtelkaMonospacePro"; sizeEx="3.875 * (1 / (getResolution select 3)) * pixelGrid * 0.5"; onKillFocus=" comment 'DO NOT COPY THIS CODE TO YOUR ATTRIBUTE CONFIG UNLESS YOU ARE CHANGING SOMETHING IN THE CODE!'; _ctrlGroup = ctrlParentControlsGroup (_this select 0); _ctrlSlider = _ctrlGroup controlsgroupctrl 100; _ctrlHour = _ctrlGroup controlsgroupctrl 101; _ctrlMinute = _ctrlGroup controlsgroupctrl 102; _ctrlSecond = _ctrlGroup controlsgroupctrl 103; _range = sliderrange _ctrlSlider; _value = (round (parsenumber ctrltext _ctrlHour) + round (parsenumber ctrltext _ctrlMinute) / 60 + round (parsenumber ctrltext _ctrlSecond) / 3600) * 3600; _ctrlSlider slidersetposition (_value / (sliderspeed _ctrlSlider select 1)); _ctrlCfg = configfile >> 'Cfg3DEN' >> 'Attributes' >> ctrlclassname _ctrlGroup; [_ctrlSlider,sliderposition _ctrlSlider] call compile gettext (_ctrlCfg >> 'Controls' >> 'Value' >> 'onSliderPosChanged'); "; }; class Minute: Hour { idc=102; tooltip="$STR_3DEN_Attributes_SliderTime_Minute_tooltip"; x="( 48 + 82 - 8 * 2) * (pixelW * pixelGrid * 0.50)"; w="8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; class Second: Hour { idc=103; tooltip="$STR_3DEN_Attributes_SliderTime_Second_tooltip"; x="( 48 + 82 - 8) * (pixelW * pixelGrid * 0.50)"; w="8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; }; }; class SliderTimeDay: SliderTime { h="1 * 5 * (pixelH * pixelGrid * 0.50)"; onValueChanged="_this call bis_fnc_3DENIntel;"; class Controls: Controls { class Title: Title { }; class Preview: ctrlControlsGroupNoScrollbars { idc=110; x="( 48 + 1.11 * 5) * (pixelW * pixelGrid * 0.50)"; y=0; w="( 82 - 8 * 3 - 2.22 * 5) * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; onLoad="uinamespace setvariable ['AttributeSliderTimeDay_group',_this select 0];"; class Controls { class PreviewNight1: ctrlStaticPicture { idc=111; text="\a3\3DEN\Data\Attributes\SliderTimeDay\night_ca.paa"; colorText[]={1,1,1,0.60000002}; x=0; w="0.5 * 5 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; class PreviewNight2: PreviewNight1 { idc=112; }; class PreviewDay: PreviewNight1 { idc=113; text="\a3\3DEN\Data\Attributes\SliderTimeDay\day_ca.paa"; }; class PreviewSunrise: PreviewNight1 { idc=114; text="\a3\3DEN\Data\Attributes\SliderTimeDay\sunrise_ca.paa"; }; class PreviewSunset: PreviewNight1 { idc=115; text="\a3\3DEN\Data\Attributes\SliderTimeDay\sunset_ca.paa"; }; class Sun: ctrlStaticPicture { idc=116; text="\a3\3DEN\Data\Attributes\SliderTimeDay\sun_ca.paa"; colorText[]={1,1,1,0.60000002}; x="( 82 - 8 * 3 - (2.22 + 1) * 5) * 0.5 * (pixelW * pixelGrid * 0.50)"; w="5 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; }; }; class Value: Value { idc=100; sliderRange[]={0,23.999901}; sliderPosition=12; lineSize=1; pageSize=3600; border="\a3\3DEN\Data\Attributes\SliderTimeDay\border_ca.paa"; thumb="\a3\3DEN\Data\Attributes\SliderTimeDay\thumb_ca.paa"; color[]={1,1,1,0.60000002}; colorActive[]={1,1,1,1}; }; class Frame: Frame { }; class Separator: Separator { }; class Hour: Hour { }; class Minute: Minute { }; class Second: Second { }; }; }; Taken from \a3\3den\config.cpp 1 Share this post Link to post Share on other sites
samir17864 44 Posted July 17, 2023 11 hours ago, Larrow said: this. You can always look inside the config\extracted files to see how it is done. Reveal hidden contents class ctrlDefault { access=0; idc=-1; style=0; default=0; show=1; fade=0; blinkingPeriod=0; deletable=0; x=0; y=0; w=0; h=0; tooltip=""; tooltipMaxWidth=0.5; tooltipColorShade[]={0,0,0,1}; tooltipColorText[]={1,1,1,1}; tooltipColorBox[]={0,0,0,0}; class ScrollBar { width=0; height=0; scrollSpeed=0.059999999; arrowEmpty="\a3\3DEN\Data\Controls\ctrlDefault\arrowEmpty_ca.paa"; arrowFull="\a3\3DEN\Data\Controls\ctrlDefault\arrowFull_ca.paa"; border="\a3\3DEN\Data\Controls\ctrlDefault\border_ca.paa"; thumb="\a3\3DEN\Data\Controls\ctrlDefault\thumb_ca.paa"; color[]={1,1,1,1}; }; }; class ctrlXSliderV: ctrlDefault { type=43; style=0; color[]={1,1,1,0.60000002}; colorActive[]={1,1,1,1}; colorDisabled[]={1,1,1,0.25}; sliderRange[]={0,1}; sliderPosition=1; lineSize=0.1; arrowEmpty="\a3\3DEN\Data\Controls\CtrlXSlider\arrowEmpty_ca.paa"; arrowFull="\a3\3DEN\Data\Controls\CtrlXSlider\arrowFull_ca.paa"; border="\a3\3DEN\Data\Controls\CtrlXSlider\border_ca.paa"; thumb="\a3\3DEN\Data\Controls\CtrlXSlider\thumb_ca.paa"; class Title { idc=-1; colorBase[]={1,1,1,1}; colorActive[]= { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])", 1 }; }; class Value { idc=-1; format="%.f"; type="SPTPlain"; colorBase[]={1,1,1,1}; colorActive[]= { "(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])", "(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])", "(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])", 1 }; }; onCanDestroy=""; onDestroy=""; onSetFocus=""; onKillFocus=""; onKeyDown=""; onKeyUp=""; onMouseButtonDown=""; onMouseButtonUp=""; onMouseButtonClick=""; onMouseButtonDblClick=""; onMouseZChanged=""; onMouseMoving=""; onMouseHolding=""; onSliderPosChanged=""; }; class ctrlXSliderH: ctrlXSliderV { style=1024; }; class SliderTime: Title { attributeLoad=" (_this controlsGroupCtrl 100) slidersetposition _value; [_this controlsGroupCtrl 100,_value] call compile gettext (configfile >> 'Cfg3DEN' >> 'Attributes' >> 'SliderTime' >> 'Controls' >> 'Value' >> 'onSliderPosChanged'); "; attributeSave=" sliderposition (_this controlsGroupCtrl 100) "; class Controls: Controls { class Title: Title { }; class Value: ctrlXSliderH { idc=100; x="48 * (pixelW * pixelGrid * 0.50)"; w="( 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; sliderRange[]={0,3600}; sliderPosition=0; pageSize=1; onSliderPosChanged=" comment 'DO NOT COPY THIS CODE TO YOUR ATTRIBUTE CONFIG UNLESS YOU ARE CHANGING SOMETHING IN THE CODE!'; _ctrlSlider = _this select 0; _value = (_this select 1) * (sliderspeed _ctrlSlider select 1); _valueHour = floor (_value / 3600); _valueMinute = floor ((_value / 60) % 60); _valueSecond = floor (_value % 60); _textHour = if (_valueHour < 10) then {'0' + str _valueHour} else {str _valueHour}; _textMinute = if (_valueMinute < 10) then {'0' + str _valueMinute} else {str _valueMinute}; _textSecond = if (_valueSecond < 10) then {'0' + str _valueSecond} else {str _valueSecond}; _ctrlGroup = ctrlParentControlsGroup _ctrlSlider; _ctrlHour = _ctrlGroup controlsgroupctrl 101; _ctrlMinute = _ctrlGroup controlsgroupctrl 102; _ctrlSecond = _ctrlGroup controlsgroupctrl 103; _ctrlHour ctrlsettext _textHour; _ctrlMinute ctrlsettext _textMinute; _ctrlSecond ctrlsettext _textSecond; _ctrlCfg = configfile >> 'Cfg3DEN' >> 'Attributes' >> ctrlclassname _ctrlGroup; _code = gettext (_ctrlCfg >> 'onValueChanged'); if (_code != '') then {[_ctrlGroup,_value] call compile _code;}; "; }; class Frame: ctrlStaticFrame { x="( 48 + 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; w="3 * 8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; class Separator: ctrlStatic { style=2; x="( 48 + 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; w="3 * 8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; font="EtelkaMonospacePro"; sizeEx="3.875 * (1 / (getResolution select 3)) * pixelGrid * 0.5"; colorBackground[]={0,0,0,0.5}; text=": :"; }; class Hour: ctrlEdit { idc=101; text="00"; tooltip="$STR_3DEN_Attributes_SliderTime_Hour_tooltip"; style="0x02 + 0x200"; x="( 48 + 82 - 8 * 3) * (pixelW * pixelGrid * 0.50)"; w="8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; colorBackground[]={0,0,0,0}; font="EtelkaMonospacePro"; sizeEx="3.875 * (1 / (getResolution select 3)) * pixelGrid * 0.5"; onKillFocus=" comment 'DO NOT COPY THIS CODE TO YOUR ATTRIBUTE CONFIG UNLESS YOU ARE CHANGING SOMETHING IN THE CODE!'; _ctrlGroup = ctrlParentControlsGroup (_this select 0); _ctrlSlider = _ctrlGroup controlsgroupctrl 100; _ctrlHour = _ctrlGroup controlsgroupctrl 101; _ctrlMinute = _ctrlGroup controlsgroupctrl 102; _ctrlSecond = _ctrlGroup controlsgroupctrl 103; _range = sliderrange _ctrlSlider; _value = (round (parsenumber ctrltext _ctrlHour) + round (parsenumber ctrltext _ctrlMinute) / 60 + round (parsenumber ctrltext _ctrlSecond) / 3600) * 3600; _ctrlSlider slidersetposition (_value / (sliderspeed _ctrlSlider select 1)); _ctrlCfg = configfile >> 'Cfg3DEN' >> 'Attributes' >> ctrlclassname _ctrlGroup; [_ctrlSlider,sliderposition _ctrlSlider] call compile gettext (_ctrlCfg >> 'Controls' >> 'Value' >> 'onSliderPosChanged'); "; }; class Minute: Hour { idc=102; tooltip="$STR_3DEN_Attributes_SliderTime_Minute_tooltip"; x="( 48 + 82 - 8 * 2) * (pixelW * pixelGrid * 0.50)"; w="8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; class Second: Hour { idc=103; tooltip="$STR_3DEN_Attributes_SliderTime_Second_tooltip"; x="( 48 + 82 - 8) * (pixelW * pixelGrid * 0.50)"; w="8 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; }; }; class SliderTimeDay: SliderTime { h="1 * 5 * (pixelH * pixelGrid * 0.50)"; onValueChanged="_this call bis_fnc_3DENIntel;"; class Controls: Controls { class Title: Title { }; class Preview: ctrlControlsGroupNoScrollbars { idc=110; x="( 48 + 1.11 * 5) * (pixelW * pixelGrid * 0.50)"; y=0; w="( 82 - 8 * 3 - 2.22 * 5) * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; onLoad="uinamespace setvariable ['AttributeSliderTimeDay_group',_this select 0];"; class Controls { class PreviewNight1: ctrlStaticPicture { idc=111; text="\a3\3DEN\Data\Attributes\SliderTimeDay\night_ca.paa"; colorText[]={1,1,1,0.60000002}; x=0; w="0.5 * 5 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; class PreviewNight2: PreviewNight1 { idc=112; }; class PreviewDay: PreviewNight1 { idc=113; text="\a3\3DEN\Data\Attributes\SliderTimeDay\day_ca.paa"; }; class PreviewSunrise: PreviewNight1 { idc=114; text="\a3\3DEN\Data\Attributes\SliderTimeDay\sunrise_ca.paa"; }; class PreviewSunset: PreviewNight1 { idc=115; text="\a3\3DEN\Data\Attributes\SliderTimeDay\sunset_ca.paa"; }; class Sun: ctrlStaticPicture { idc=116; text="\a3\3DEN\Data\Attributes\SliderTimeDay\sun_ca.paa"; colorText[]={1,1,1,0.60000002}; x="( 82 - 8 * 3 - (2.22 + 1) * 5) * 0.5 * (pixelW * pixelGrid * 0.50)"; w="5 * (pixelW * pixelGrid * 0.50)"; h="5 * (pixelH * pixelGrid * 0.50)"; }; }; }; class Value: Value { idc=100; sliderRange[]={0,23.999901}; sliderPosition=12; lineSize=1; pageSize=3600; border="\a3\3DEN\Data\Attributes\SliderTimeDay\border_ca.paa"; thumb="\a3\3DEN\Data\Attributes\SliderTimeDay\thumb_ca.paa"; color[]={1,1,1,0.60000002}; colorActive[]={1,1,1,1}; }; class Frame: Frame { }; class Separator: Separator { }; class Hour: Hour { }; class Minute: Minute { }; class Second: Second { }; }; }; Taken from \a3\3den\config.cpp That is exactly what I did ... I am working on it now, and I am going to make it more simple but it will give me a similar slider ... When I finish, I will post in here the full code that can be used in .hpp or .cpp files ... Thank you guys for your nice replies. 1 Share this post Link to post Share on other sites