Jump to content

tUnipanel Cambiar color via ClientEvents (Resuelto)


Luis Devis

Recommended Posts

Hola, gracias por interesarte.

Necesito que un panel cambie de color cuando se pulsa sobre el y recupere el color original cuando se suelta el raton o el dedo.
No quiero hacerlo via código porque es muy lento, me gustaria usar ClientEvents pero estoy muy verde en eso.

Muchas gracias por tu ayuda

Link to comment
Share on other sites

  • Luis Devis changed the title to tUnipanel Cambiar color via ClientEvents (Resuelto)

Finalmente este es el resultado que me dieron, y funciona.
 

Okay. Try this approach.

1. 

Uses ... , UniGUIJSUtils;

2. 

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniPanel1 do
    JSInterface.JSAssign('originalBGColor', [uniColor2Web(Color)]);
end;

3. UniPanel1 -> ClientEvents -> ExtEvents ->

function mousedown(sender, x, y, eOpts)
{
    sender.setBodyStyle('background-color', 'green');
}

function mouseup(sender, x, y, eOpts)
{
    sender.setBodyStyle('background-color', sender.originalBGColor);
}
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...