mos Posted September 25, 2020 Posted September 25, 2020 I have the following code: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniButton1.Color := clRed; end; However the button color does not change. How can I change the background color? Quote
x11 Posted September 25, 2020 Posted September 25, 2020 http://forums.unigui.com/index.php?/topic/14107-using-css/ Quote
mos Posted September 25, 2020 Author Posted September 25, 2020 I need to change the background color at runtime based on the user that has logged in. In other words I need to be able to change it dynamically. Quote
Sherzod Posted September 25, 2020 Posted September 25, 2020 5 minutes ago, mos said: I need to change the background color at runtime based on the user that has logged in. In other words I need to be able to change it dynamically. Also this post may help you: 1 Quote
Abaksoft Posted January 12, 2021 Posted January 12, 2021 Hello Sherzod, If i use a more simple method (CSS), i have the result : Putting this CSS on ServerModule > CustomCSS and bg on Unibutton1 > LayoutConfig > CLS 1. This gives the color .bg { background-image: none; background-color: green; } 2. This Not : .bg { background-color: green; } 3. If I use a big font then it overlaps How can i avoid overlap ? Thx Quote
Sherzod Posted January 12, 2021 Posted January 12, 2021 21 minutes ago, Abaksoft said: 3. If I use a big font then it overlaps How can i avoid overlap ? Hi Mohammed, Can you try: 1 Quote
Abaksoft Posted January 12, 2021 Posted January 12, 2021 Many thx Sorry for the inconvenience. 1 Quote
Abaksoft Posted January 13, 2021 Posted January 13, 2021 Hello Unigueers, Please Share your expertise ! Many of us don't share any thing, probably thinking it's elementary. it's wrong ! I keep saying : "Share, Share, Share and more" ... even if it's simple. --> This will save us a lot of time. So, for Who just come to Unigui world, here is a simple way do set dynamically (at runtime) the Unibutton color Background. Color Background, say you ? Yes ... as it's not obvious at all (thx to Sherzod) : with UniButton1.JSInterface do begin JSCall('btnWrap.setStyle', ['background-image', '"none"']); JSCall('btnWrap.setStyle', ['background-color', 'rgb(0,128,128)']); end; You can use : https://www.w3schools.com/css/css_colors_rgb.asp To convert Colors in rgb and rgba format (a = Alpha = Transparency). 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.