innocon Posted October 2, 2013 Share Posted October 2, 2013 Hi, I like to change the font color of a button when I move my mouse over it. To achieve this I changed the css: .x-btn { background: white !important; } .x-btn-over { background: black !important; } But this doesn't work. Quote Link to comment Share on other sites More sharing options...
rullomare Posted October 2, 2013 Share Posted October 2, 2013 Hi, add in servermodule> CustomCss and try again Best regards Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 2, 2013 Share Posted October 2, 2013 Hi JRV. .x-btn .x-btn-inner { color: white !important; } .x-btn-over .x-btn-inner { color: black !important; } Best regards... 1 Quote Link to comment Share on other sites More sharing options...
innocon Posted October 3, 2013 Author Share Posted October 3, 2013 Thanks duser! Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 28, 2021 Share Posted October 28, 2021 Hello, is there a way to assign each button individually? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2021 Share Posted October 28, 2021 22 minutes ago, plawan001 said: Hello, is there a way to assign each button individually? Hello, Yes. By adding LayoutConfig -> Cls... Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 28, 2021 Share Posted October 28, 2021 Do you have an example? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2021 Share Posted October 28, 2021 42 minutes ago, plawan001 said: Do you have an example? 1. UniServerModule -> CustomCSS: .customBtnOver .x-btn-inner { color: green; font-weight: bold; } 2. procedure TMainForm.UniFormCreate(Sender: TObject); begin UniButton1.JSInterface.JSConfig('overCls', ['customBtnOver']); end; Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 28, 2021 Share Posted October 28, 2021 I've tried that, it turns bold. but does not change color 😥 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2021 Share Posted October 28, 2021 1 minute ago, plawan001 said: but does not change color What color are you setting? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2021 Share Posted October 28, 2021 Have you tried using the method above? Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 28, 2021 Share Posted October 28, 2021 I set green according to the method you provided the sample Quote Link to comment Share on other sites More sharing options...
irigsoft Posted October 28, 2021 Share Posted October 28, 2021 Where you want to change the color ? On Form creation or on button click ? here is javascript code in button click: uniSession.AddJS (document.getElementById("YOUBUTTON_jsID").style.color = "red";); this change background: uniSession.AddJS (document.getElementById("YOUBUTTON_jsID").style.background = "green";); Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2021 Share Posted October 28, 2021 4 minutes ago, plawan001 said: I set green according to the method you provided the sample 46 minutes ago, Sherzod said: .x-btn-inner You may already using this class, where possible already used !important Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 28, 2021 Share Posted October 28, 2021 Can you test this with a simple app? Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 29, 2021 Share Posted October 29, 2021 Can a button change the font color when the mouse is hovered over the button? TestButton.mp4 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2021 Share Posted October 29, 2021 1 hour ago, plawan001 said: Can a button change the font color when the mouse is hovered over the button? Please make a simple testcase, not a video. Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 29, 2021 Share Posted October 29, 2021 Test.zip Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2021 Share Posted October 29, 2021 Ok, thanks. I will check. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2021 Share Posted October 29, 2021 2 hours ago, plawan001 said: Test.zip 6.88 MB · 1 download 1. .button1 { background:white !important; border: 2px solid #4CAF50; } .button1:hover { background:#4CAF50 !important; border: 2px solid #4CAF50; color: white !important; transition-duration: 0.5s; } .customHover .x-btn-inner { color: white !important; transition-duration: 0.5s; } 2. procedure TMainForm.UniFormCreate(Sender: TObject); begin UniButton1.JSInterface.JSConfig('overCls', ['customHover']) end; Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 29, 2021 Share Posted October 29, 2021 I did and it still doesn't work. The font still doesn't change color when mouse over the button. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2021 Share Posted October 29, 2021 Sorry, Does the color change? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted October 29, 2021 Share Posted October 29, 2021 8 minutes ago, plawan001 said: I did and it still doesn't work. The font still doesn't change color when mouse over the button. 1. Modified CSS: .button1 { background:white !important; border: 2px solid #4CAF50; } .button1:hover { background:#4CAF50 !important; border: 2px solid #4CAF50; color: white !important; transition-duration: 0.5s; } .customHover .x-btn-inner { color: white !important; font: italic small-caps bold 12px/30px Georgia, serif; transition-duration: 0.5s; } 2. Do not forget procedure TMainForm.UniFormCreate(Sender: TObject); begin UniButton1.JSInterface.JSConfig('overCls', ['customHover']) end; 3. Result: 1 Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 29, 2021 Share Posted October 29, 2021 Thank you very much, it works😄 1 Quote Link to comment Share on other sites More sharing options...
plawan001 Posted October 29, 2021 Share Posted October 29, 2021 Hello, would like to ask more Is there a way to change the fort color when selecting a menu? Quote Link to comment Share on other sites More sharing options...
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.