Jump to content

LoadMask | Font Awesome


Recommended Posts

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
Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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:

 

Link to comment
Share on other sites

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;

 

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

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