Jump to content

TuniEdit fontcolor and background color


chrisjohn82

Recommended Posts

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 

Link to comment
Share on other sites

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";
}
Link to comment
Share on other sites

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;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...