Jump to content

Recommended Posts

Posted
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.2020-03-03_084540.png.89950522f06cc25cc85490aec773a551.png

Why you don't want use UniProgressBar?

Posted
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.

Posted
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. 

Posted
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;

 

  • Upvote 1
Posted
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.

Posted
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.

Posted
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?

Posted
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;

 

Posted
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.

Posted
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;

uniBtnProgress.png.acdd3ef04de13e8902a692c784183d4c.png

Posted
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;

uniBtnProgress.png.acdd3ef04de13e8902a692c784183d4c.png

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?

  • Like 1
Posted
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)']);

 

Posted
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))']);

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...