Jump to content

Recommended Posts

Posted

LoadMaskFA3.gif.5172b38b6abf29440dff058a9ba84c75.gif

Simple usage:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  try
    Sleep(5000);
  finally
    JSInterface.JSCall('setDisabled', [False], (Sender as TUniButton).JSControl)
  end;
end;

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniButton1.JSInterface do
  begin
    JSConfig('_iconCls', ['x-fa fa-save']);
    JSConfig('iconAlign', ['right']);
    JSAddListener('disable', 'function(){this.setIconCls("x-fa fa-spinner fa-spin")}');
    JSAddListener('enable', 'function(){this.setIconCls(this.getConfig("_iconCls"))}');
    JSAddListener('click', 'function(){this.setDisabled(true)}');
  end;
end;

 

  • Like 5
  • Thanks 1
Posted
1 hour ago, Sherzod said:

LoadMaskFA3.gif.5172b38b6abf29440dff058a9ba84c75.gif

Simple usage:

procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  try
    Sleep(5000);
  finally
    JSInterface.JSCall('setDisabled', [False], (Sender as TUniButton).JSControl)
  end;
end;

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniButton1.JSInterface do
  begin
    JSConfig('_iconCls', ['x-fa fa-save']);
    JSConfig('iconAlign', ['right']);
    JSAddListener('disable', 'function(){this.setIconCls("x-fa fa-spinner fa-spin")}');
    JSAddListener('enable', 'function(){this.setIconCls(this.getConfig("_iconCls"))}');
    JSAddListener('click', 'function(){this.setDisabled(true)}');
  end;
end;

 

Sherzod, Put any rule in the button's Onclick event the first time works, the second no longer triggers the click

Posted
procedure TMainForm.UniButton1Click(Sender: TObject);
begin
  (Sender as TUniButton).JSInterface.JSCall('setText', ['Start']);
  try
    Sleep(5000);
  finally
    (Sender as TUniButton).Caption := 'Finish';
    (Sender as TUniButton).JSInterface.JSCall('setDisabled', [False], (Sender as TUniButton).JSControl)
  end;
end;

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniButton1.JSInterface do
  begin
    JSConfig('_iconCls', ['x-fa fa-save']);
    JSConfig('iconAlign', ['left']);
    JSAddListener('disable', 'function(){this.setIconCls("x-fa fa-spinner fa-spin")}');
    JSAddListener('enable', 'function(){this.setIconCls(this.getConfig("_iconCls"))}');
    JSAddListener('click', 'function(){this.setDisabled(true)}');
  end;
end;

I just couldn't change the caption of the button on click.

Posted
59 minutes ago, picyka said:

Sherzod, you who are the master, a challenge hahaha,

and if it were an OnColumnActionClick on the grid,

what would be your magic?

:) 

In such a case, where should the mask be applied? UniDBGrid?

Posted
1 hour ago, picyka said:

Sherzod, you who are the master, a challenge hahaha,

and if it were an OnColumnActionClick on the grid,

what would be your magic?

😀

 

18 minutes ago, Sherzod said:

:) 

In such a case, where should the mask be applied? UniDBGrid?

For this case it is better to use UniButtonWidget, for example:

 

Posted
47 minutes ago, picyka said:

I just couldn't change the caption of the button on click.

 

44 minutes ago, Sherzod said:
47 minutes ago, picyka said:
JSAddListener('click', 'function(){this.setDisabled(true)}');
  end;

Should be added here.

procedure TMainForm.UniFormCreate(Sender: TObject);
begin
  with UniButton1.JSInterface, UniButton1 do
  begin
    JSConfig('_iconCls', ['x-fa fa-save']);
    JSConfig('_text', [Caption]);
    JSConfig('iconAlign', ['right']);
    JSAddListener('disable', 'function(){this.setIconCls("x-fa fa-spinner fa-spin")}');
    JSAddListener('enable', 'function(){this.setIconCls(this.getConfig("_iconCls")); this.setText(this.getConfig("_text"))}');
    JSAddListener('click', 'function(){this.setDisabled(true); this.setText("Saving...")}');
  end;
end;

 

Posted
52 minutes ago, Sherzod said:

 

For this case it is better to use UniButtonWidget, for example:

 

Would it be possible to change the icon and make it rotate, in the grid column itself?

Posted
3 minutes ago, picyka said:

Would it be possible to change the icon and make it rotate, in the grid column itself?

So, do you mean using actioncolumn?

Posted
Just now, Sherzod said:

Então, você quer dizer usar a coluna de ação?

Honestly, I don't know if that would be the best place, I have to search for models on the web, to see how common it is to do this in systems

Posted

My standard registration screen always opens a query, where there are actions.

Can I use the UniTabSheet.Caption instead of using the Grid's ScreenLoad?

 

Something similar to the animation that the browser itself has..

 

Another modern animation would be this one

time 3:52

Capturar.PNG

Capturar2.PNG

Posted
procedure TUniFrameCons.UniDBGridConsultaAfterLoad(Sender: TUniCustomDBGrid);
begin
  if (Self.Parent is TUniTabSheet) then
    TUniTabSheet(Self.Parent).ImageIndex := 49;
end;

procedure TUniFrameCons.UniDBGridConsultaBeforeLoad(Sender: TUniCustomDBGrid);
begin
  if (Self.Parent is TUniTabSheet) then
    TUniTabSheet(Self.Parent).ImageIndex := 3;
end;

I thought of something like this but it didn't work as expected, maybe some client side event

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