55143681 Posted March 3, 2020 Share Posted March 3, 2020 I want to use UniBitBtn to do something, 1。How to change UniBitBtn's color? 2.How to mark the progress just like UniProgressBar? Thanks everyone. Quote Link to comment Share on other sites More sharing options...
artem_niko Posted March 3, 2020 Share Posted March 3, 2020 52 minutes ago, 55143681 said: I want to use UniBitBtn to do something, 1。How to change UniBitBtn's color? 2.How to mark the progress just like UniProgressBar? Thanks everyone. Why you don't want use UniProgressBar? Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 4, 2020 Author Share Posted March 4, 2020 12 hours ago, Артем said: Why you don't want use UniProgressBar? Because UniProgressBar does not have OnClick, I need click it to call another function, and at the same time , I want to show the progress and the status(color), thank you. Quote Link to comment Share on other sites More sharing options...
artem_niko Posted March 4, 2020 Share Posted March 4, 2020 5 minutes ago, 55143681 said: Because UniProgressBar does not have OnClick, I need click it to call another function, and at the same time , I want to show the progress and the status(color), thank you. I have code, whos change color on UniProgressBar. I think, that this is code help you to change color of button. At the end Day I give you him. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 4, 2020 Share Posted March 4, 2020 5 hours ago, 55143681 said: Because UniProgressBar does not have OnClick, 1. UniProgressBar1.ClientEvents.ExtEvents -> function click(sender, eOpts) { ajaxRequest(sender, 'click', ['val=' + sender.getValue()]); } 2. UniProgressBar1 -> OnAjaxEvent: procedure TMainForm.UniProgressBar1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'click' then begin // val*100 = Position ShowMessage(Params.Values['val']); end; end; 1 Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 5, 2020 Author Share Posted March 5, 2020 On 3/4/2020 at 8:32 AM, Артем said: I have code, whos change color on UniProgressBar. I think, that this is code help you to change color of button. At the end Day I give you him. Thank you. Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 5, 2020 Author Share Posted March 5, 2020 On 3/4/2020 at 1:52 PM, Sherzod said: 1. UniProgressBar1.ClientEvents.ExtEvents -> function click(sender, eOpts) { ajaxRequest(sender, 'click', ['val=' + sender.getValue()]); } 2. UniProgressBar1 -> OnAjaxEvent: procedure TMainForm.UniProgressBar1AjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'click' then begin // val*100 = Position ShowMessage(Params.Values['val']); end; end; Thank you,shezrod.this is a good way, but, Can I do that through UniBitBtn? I would like use UniBitBtn to that,change the color and use color to show the progress just like uniProgressBar. Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 5, 2020 Author Share Posted March 5, 2020 Just now, 55143681 said: Thank you,shezrod.this is a good way, but, Can I do that through UniBitBtn? I would like use UniBitBtn to that,change the color and use color to show the progress just like uniProgressBar. and if I can do that, because I create UniBitBtn dynamicly, then ,How to add the method to UniBitBtn? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 5, 2020 Share Posted March 5, 2020 17 minutes ago, 55143681 said: How to add the method to UniBitBtn? What method? Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 5, 2020 Author Share Posted March 5, 2020 9 minutes ago, Sherzod said: What method? Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 5, 2020 Author Share Posted March 5, 2020 8 minutes ago, 55143681 said: And how to set UniBitBtn's caption 's Align?alLeft\alRight\alCenter? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 5, 2020 Share Posted March 5, 2020 19 minutes ago, 55143681 said: And how to set UniBitBtn's caption 's Align?alLeft\alRight\alCenter? procedure TMainForm.UniFormCreate(Sender: TObject); begin UniBitBtn1.JSInterface.JSConfig('textAlign', ['left']); //center, left, right. Defaults to:'center' end; Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 5, 2020 Author Share Posted March 5, 2020 1 minute ago, Sherzod said: procedure TMainForm.UniFormCreate(Sender: TObject); begin UniBitBtn1.JSInterface.JSConfig('textAlign', ['left']); //center, left, right. Defaults to:'center' end; You are my Best Friend! haha.:) And I wish that you can help me to resolve my needs. 1.change UniBitBtn 's color 2.use the color represent the total progress just like uniProgressBar. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 5, 2020 Share Posted March 5, 2020 45 minutes ago, 55143681 said: 1.change UniBitBtn 's color 2.use the color represent the total progress just like uniProgressBar. procedure TMainForm.UniBitBtn1Click(Sender: TObject); var vPosition: Integer; begin vPosition := 75; with UniBitBtn1.JSInterface do begin JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, green, lime)']); JSCall('btnWrap.setStyle', ['background-size', vPosition.ToString + '% 100%']); JSCall('btnWrap.setStyle', ['background-repeat', 'no-repeat']); end; end; Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 7, 2020 Author Share Posted March 7, 2020 On 3/5/2020 at 6:03 PM, Sherzod said: procedure TMainForm.UniBitBtn1Click(Sender: TObject); var vPosition: Integer; begin vPosition := 75; with UniBitBtn1.JSInterface do begin JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, green, lime)']); JSCall('btnWrap.setStyle', ['background-size', vPosition.ToString + '% 100%']); JSCall('btnWrap.setStyle', ['background-repeat', 'no-repeat']); end; end; Sherzod:Thank you very very much,that is just what I want.,you are the best. I want to know if I want to use yellow and red, then "green lime " will be replaced with what for yellow? replaced with what for red? 1 Quote Link to comment Share on other sites More sharing options...
Sherzod Posted March 7, 2020 Share Posted March 7, 2020 5 minutes ago, 55143681 said: I want to know if I want to use yellow and red, then "green lime " will be replaced with what for yellow? replaced with what for red? JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, yellow, red)']); You can also use several colors: JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, yellow, orange, red)']); Quote Link to comment Share on other sites More sharing options...
55143681 Posted March 7, 2020 Author Share Posted March 7, 2020 4 hours ago, Sherzod said: JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, yellow, red)']); You can also use several colors: JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, yellow, orange, red)']); Thanks a lot. Another way. JSCall('btnWrap.setStyle', ['background-image', 'linear-gradient(to right, rgba(255,255,0,0),rgba(255,255,0,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.