Luis Devis Posted July 5, 2021 Share Posted July 5, 2021 Hi, thanks for your interest in my topic. I need to use a tUnipanel that changes its color when it is pressed (mousedown) and go back to its original back color when the mouse/finger releases (mouseup). I don't want to use Delphi code because it is too slow, I'd rather use ClientEvents but I'm not yet used to them. Can you lend me a hand? Thanks a lot for your help Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 5, 2021 Share Posted July 5, 2021 Hello, BackgroundColor? Quote Link to comment Share on other sites More sharing options...
Luis Devis Posted July 5, 2021 Author Share Posted July 5, 2021 Yes, the user should know that the panel has been pressed, otherwise they keep pressing and pressing and touching and breaking the screen 😄 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 5, 2021 Share Posted July 5, 2021 41 minutes ago, Luis Devis said: the user should know that the panel has been pressed, otherwise they keep pressing and pressing and touching and breaking the screen Well, actually a panel is a container. It contains elements for interaction with the user. Quote Link to comment Share on other sites More sharing options...
Luis Devis Posted July 5, 2021 Author Share Posted July 5, 2021 So, according to the answers, I gess that there is no way to do what I've asked. Quote Link to comment Share on other sites More sharing options...
Luis Devis Posted July 5, 2021 Author Share Posted July 5, 2021 OK. Please change the concept and question over a tUniPanel into tUniButton. Hopw can I change the backGroudcolor of a tUnibutton when it is pressed and released using ClientEvents Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 6, 2021 Share Posted July 6, 2021 6 hours ago, Luis Devis said: So, according to the answers, I gess that there is no way to do what I've asked. Yes, it is possible to track panel clicks... 6 hours ago, Luis Devis said: Hopw can I change the backGroudcolor of a tUnibutton when it is pressed and released using ClientEvents Please clarify the question again. Since the UniButton has no state - pressed. Quote Link to comment Share on other sites More sharing options...
Luis Devis Posted July 6, 2021 Author Share Posted July 6, 2021 OK, no matter what kind of UNIGUI control I will use. I need a control that changes its colour (backcolor) when the event mouseon happens and returns to its original value when mouseup event happens. And... I want to do it via ClientEvents, if possible, not using the Delphi classic events. The idea is to improve navigators response speed. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted July 6, 2021 Share Posted July 6, 2021 On 7/5/2021 at 8:48 PM, Luis Devis said: I need to use a tUnipanel that changes its color when it is pressed (mousedown) and go back to its original back color when the mouse/finger releases (mouseup). I don't want to use Delphi code because it is too slow, I'd rather use ClientEvents but I'm not yet used to them. Can you lend me a hand? 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); } Quote Link to comment Share on other sites More sharing options...
Luis Devis Posted July 7, 2021 Author Share Posted July 7, 2021 Yessssss !!!! I haven't tried it yet but this is exactly what I was asking for. Thanks so much Sherzod 1 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.