Jump to content

Recommended Posts

Posted
Hello friends. Necesito call showmask via JS code in situations which do not own visual component that will trigger by a user click.

 

Does anyone know tell me how could run it.

  • Administrators
Posted


unit Main;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics,
Controls, Forms, Dialogs, uniGUITypes, uniGUIAbstractClasses,
uniGUIClasses, uniGUIRegClasses, uniGUIForm, uniGUIBaseClasses, uniEdit,
uniButton;

type
TMainForm = class(TUniForm)
UniButton1: TUniButton;
UniEdit1: TUniEdit;
procedure UniEdit1AjaxEvent(Sender: TComponent; EventName: string;
Params: TUniStrings);
private
{ Private declarations }
public
{ Public declarations }
end;

function MainForm: TMainForm;

implementation

{$R *.dfm}

uses
uniGUIVars, MainModule, uniGUIApplication, Unit1;

function MainForm: TMainForm;
begin
Result := TMainForm(UniMainModule.GetFormInstance(TMainForm));
end;

procedure TMainForm.UniEdit1AjaxEvent(Sender: TComponent; EventName: string;
Params: TUniStrings);
begin
if EventName = 'CR' then
begin
Sleep(1000); // your big task here!
end;
end;

initialization
RegisterAppFormClass(TMainForm);

end.


object MainForm: TMainForm
Left = 0
Top = 0
ClientHeight = 396
ClientWidth = 616
Caption = 'MainForm'
OldCreateOrder = False
MonitoredKeys.Keys =
PixelsPerInch = 96
TextHeight = 13
object UniEdit1: TUniEdit
Left = 184
Top = 216
Width = 121
Hint = ''
Text = 'UniEdit1'
TabOrder = 0
ClientEvents.ExtEvents.Strings = (

'keypress=function keypress(sender, e, eOpts)'#13#10'{'#13#10' if (e.getKey(' +
') == 13 ) {'#13#10' sender.showMask('#39'Please wait'#39');'#13#10' ajaxRequ' +
'est(sender, '#39'CR'#39', []); '#13#10' }'#13#10'}')
OnAjaxEvent = UniEdit1AjaxEvent
end
end
Posted

I use this simple approach for custom events  :)  In JS code

MainForm.form.showMask('Loading...');
ajaxRequest(...);

In ajax event

try
  ...
finally
  UniSession.AddJS('MainForm.form.hideMask();');
end;
  • Administrators
Posted

 

I use this simple approach for custom events  :)  In JS code

MainForm.form.showMask('Loading...');
ajaxRequest(...);

In ajax event

try
  ...
finally
  UniSession.AddJS('MainForm.form.hideMask();');
end;

 

Actually you don't need to call hideMask()

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