gc8 970 Posted March 15, 2018 Hi I'm trying to make a button change color once it's clicked (and therefore focused) but for some reason I cannot figure the color things out. Here's what I have: class TradeTab: RscButton { colorBackground[] = {0,0,1,1}; colorFocused[] = {1,0,0,1}; }; I thought setting colorFocused to red would make the button red when clicked but it just blinks between blue (colorBackground) and red. is it possible to make the button simply change color (and not blink) while focused? thx! Share this post Link to post Share on other sites
Larrow 2801 Posted March 16, 2018 Use the on#Focus events to change the back ground colour to the same as the focused color. onSetFocus = "_this select 0 ctrlSetBackgroundColor[ 1, 0, 0, 1 ]"; onKillFocus = "_this select 0 ctrlSetBackgroundColor[ 0, 0, 1, 1 ]"; 2 Share this post Link to post Share on other sites
gc8 970 Posted March 16, 2018 6 hours ago, Larrow said: Use the on#Focus events to change the back ground colour to the same as the focused color. onSetFocus = "_this select 0 ctrlSetBackgroundColor[ 1, 0, 0, 1 ]"; onKillFocus = "_this select 0 ctrlSetBackgroundColor[ 0, 0, 1, 1 ]"; Tried your code but I found out that ctrlSetBackgroundColor does not work with RscButton. The wiki states that. No idea what to try next? Share this post Link to post Share on other sites
HazJ 1288 Posted March 17, 2018 From one of my UIs: class towns : RscButton { idc = idc_spawnSelection_towns; x = 0.2125 * safezoneW + safezoneX; y = 0.22 * safezoneH + safezoneY; w = 0.1 * safezoneW; h = 0.03 * safezoneH; text = $STR_spawnSelection_towns; period = 0; periodFocus = 0; periodOver = 0; colorFocused[] = {"(profileNamespace getVariable ['GUI_BCG_RGB_R', 0.13])", "(profileNamespace getVariable ['GUI_BCG_RGB_G', 0.54])", "(profileNamespace getVariable ['GUI_BCG_RGB_B', 0.21])", 1}; colorFocusedSecondary[] = {"(profileNamespace getVariable ['GUI_BCG_RGB_R', 0.13])", "(profileNamespace getVariable ['GUI_BCG_RGB_G', 0.54])", "(profileNamespace getVariable ['GUI_BCG_RGB_B', 0.21])", 1}; colorBackground2[] = {"(profileNamespace getVariable ['GUI_BCG_RGB_R', 0.13])", "(profileNamespace getVariable ['GUI_BCG_RGB_G', 0.54])", "(profileNamespace getVariable ['GUI_BCG_RGB_B', 0.21])", 1}; colorBackgroundFocused[] = {"(profileNamespace getVariable ['GUI_BCG_RGB_R', 0.13])", "(profileNamespace getVariable ['GUI_BCG_RGB_G', 0.54])", "(profileNamespace getVariable ['GUI_BCG_RGB_B', 0.21])", 1}; colorBackgroundActive[] = {"(profileNamespace getVariable ['GUI_BCG_RGB_R', 0.13])", "(profileNamespace getVariable ['GUI_BCG_RGB_G', 0.54])", "(profileNamespace getVariable ['GUI_BCG_RGB_B', 0.21])", 1}; }; 1 Share this post Link to post Share on other sites
gc8 970 Posted March 17, 2018 @HazJ Thanks, I tried playing with those variables but couldn't yet figure it out. Share this post Link to post Share on other sites
HazJ 1288 Posted March 17, 2018 The hover affect isn't permanent. Easy to change though. You may also want to check out: RscActiveText Share this post Link to post Share on other sites