chrisjohn82 Posted March 16, 2016 Posted March 16, 2016 Hello everybody, I wonder if it's possible to change the font color and background color of TuniEdit, when you hover over the component with the mouse, i figured out how to do it on a button but not with the TuniEdit. There should be some way to do it in clientEvents? All suggestions are more than welcome. Best Regards Christian Quote
bugra Posted March 18, 2016 Posted March 18, 2016 Hi In ClientEvent find mouseover event and add this function mouseover(sender, eOpts) { document.getElementById(sender.getInputId( )).style.backgroundColor = "lightblue"; document.getElementById(sender.getInputId( )).style.color = "#FF0000"; } If you wanna change back add same code with ex-color values in mouseout event like function mouseout(sender, eOpts) { document.getElementById(sender.getInputId( )).style.backgroundColor = "#ffffff"; document.getElementById(sender.getInputId( )).style.color = "#000000"; } Quote
chrisjohn82 Posted March 21, 2016 Author Posted March 21, 2016 Thank you, Bugra Yener Sahinoglu. This was very useful and will help me a lot, is there any way to apply this code to all TuniEdit components that are in the project or do i have do to it on every TuniEdit component? Best Regards Christian Quote
bugra Posted March 22, 2016 Posted March 22, 2016 You're welcome. You could try this code procedure TMainForm.UniFormCreate(Sender: TObject); begin for i := ComponentCount - 1 downto 0 do begin if Components[i] is TUniEdit then begin (Components[i] as TUniEdit).ClientEvents.ExtEvents.Values['mouseout']:='function mouseout(sender, eOpts)'+ '{ document.getElementById(sender.getInputId( )).style.backgroundColor = "#ffffff";'+ ' document.getElementById(sender.getInputId( )).style.color = "#000000";}'; (Components[i] as TUniEdit).ClientEvents.ExtEvents.Values['mouseover']:='function mouseout(sender, eOpts)'+ '{ document.getElementById(sender.getInputId( )).style.backgroundColor = "lightblue";'+ ' document.getElementById(sender.getInputId( )).style.color = "#FF0000";}'; end; end; end; Quote
chrisjohn82 Posted March 22, 2016 Author Posted March 22, 2016 Thank you, this will definitely same a lot of time. 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.