likemike Posted March 25, 2021 Share Posted March 25, 2021 Hello! I've tested some things to change color etc. of the buttons in TUnimSegmentedButton. This is my result: JSInterface.JSAddListener('painted',JSControl.JSFunction('me', 'me.element.select(".x-body-el").elements.forEach(function(el){el.style["font-size"] = "24px"});')); JSInterface.JSAddListener('painted',JSControl.JSFunction('me', 'me.element.select(".x-body-el").elements.forEach(function(el){el.style["font-weight"] = "bold"});')); JSInterface.JSAddListener('painted',JSControl.JSFunction('me', 'me.element.select(".x-body-el").elements.forEach(function(el){el.style["line-height"] = "24px"});')); // necessary! Otherwise the text is cut off JSInterface.JSAddListener('painted',JSControl.JSFunction('me', 'me.element.select(".x-inner-el").elements.forEach(function(el){el.style["background-color"] = "red"});')); JSInterface.JSAddListener('painted',JSControl.JSFunction('me', 'me.element.select(".x-pressing").elements.forEach(function(el){el.style["background-color"] = "blue"});')); Unfortunately I didn't found, how to change the select-background color (the color of the button, which is actually set to "pressed"). Any help is appreciated! Regards Mike Link to comment Share on other sites More sharing options...
likemike Posted April 5, 2021 Author Share Posted April 5, 2021 Up - isn't there anybody you know, which parameter is responsible for the color of the pressed button? Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted April 6, 2021 Share Posted April 6, 2021 16 hours ago, likemike said: Up - isn't there anybody you know, which parameter is responsible for the color of the pressed button? Hello Which theme are you using? Link to comment Share on other sites More sharing options...
likemike Posted April 6, 2021 Author Share Posted April 6, 2021 Hello! The theme is "triton" (TouchTheme) and "classic" (Theme). Hope that helps! Link to comment Share on other sites More sharing options...
likemike Posted April 6, 2021 Author Share Posted April 6, 2021 7 hours ago, Hayri ASLAN said: Hello Which theme are you using? Hello! The theme is "triton" (TouchTheme) and "classic" (Theme). I looked here Quote ...\FMSoft\Framework\uniGUI\ext-7.0.0\build\classic\theme-triton\resources\theme-triton-all_1.css and search for "SegmentedButton", but what I found didn't help me anyway. If you find a solution, please tell me and perhaps you can describe, how to find those issues in the future. Thanks Link to comment Share on other sites More sharing options...
Hayri ASLAN Posted April 6, 2021 Share Posted April 6, 2021 2 hours ago, likemike said: Hello! The theme is "triton" (TouchTheme) and "classic" (Theme). I looked here and search for "SegmentedButton", but what I found didn't help me anyway. If you find a solution, please tell me and perhaps you can describe, how to find those issues in the future. Thanks Hello, Please use below solution. Form-> OnCreate procedure TMainmForm.UnimFormCreate(Sender: TObject); begin with UnimSegmentedButton1, JSInterface do JSAddListener('painted', JSFunction('a', 'a.getPressedButtons()[0].innerElement.dom.style.backgroundColor= "#00AA00";')); end; UnimSegmentedButton -> ClientEvents -> ExtEvents -> toggle function toggle(sender, button, isPressed, eOpts) { if (isPressed){ button.innerElement.dom.style.backgroundColor= '#00AA00'; } else{ button.innerElement.dom.style.backgroundColor= ''; } } Link to comment Share on other sites More sharing options...
likemike Posted April 7, 2021 Author Share Posted April 7, 2021 That's it ! Great! Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts