Page 1 of 1

Is there an alternative way to JQLockIndicator ...

PostPosted: 27 Oct 2016 09:45
by jorgo
Hi,

we have an existing, big project with IW and TMS components.
Now we use cgdev components for new pages.
We had constant errors with JQLockIndicator.
After changing between pages we often got "Session invalid".
After deleting JQLockIndicator the project is working correct again.
So we need a way to use the standard IWLocker of Intraweb on cgdev pages.

Following way works only with Intraweb components:
(It works not with Asynch OnClick event)

Code: Select all
procedure TIWForm2.IWButton2Click(Sender: TObject);
begin
  WebApplication.CallBackResponse.AddJavaScriptToExecute( 'ActiveLock();' );

  Sleep(5000);

  WebApplication.CallBackResponse.AddJavaScriptToExecute( 'ReleaseLock();' );
  WebApplication.ShowNotification( 'waiting for 5 seconds' );
end;


Is there a way to use the normal locker?

Kind regards

Re: Alternative to JQLockIndicator when it makes problems ..

PostPosted: 27 Oct 2016 09:48
by Alexander Bulei
Hi jorgo,

We had constant errors with JQLockIndicator.
After changing between pages we often got "Session invalid".


As you can check our demo, the component works as expected.

procedure TIWForm2.IWButton2Click(Sender: TObject);
begin
WebApplication.CallBackResponse.AddJavaScriptToExecute( 'ActiveLock();' );

Sleep(5000);

WebApplication.CallBackResponse.AddJavaScriptToExecute( 'ReleaseLock();' );
WebApplication.ShowNotification( 'waiting for 5 seconds' );
end;


It doesn't work in this way.

Best Regards.

Is there an alternative way to JQLockIndicator ...

PostPosted: 27 Oct 2016 10:36
by jorgo
Hi Alexander,

no question, JQLockIndicator is working in projects using only cgdev components.
The mixing maybe makes sometimes problems.

Is there a way to use "ActiveLock();"
There was something with

WebApplication.CallbackResponse.AddJavaScriptToExecuteAsCDATA(js);


Kind regards

Re: Is there an alternative way to JQLockIndicator ...

PostPosted: 27 Oct 2016 12:01
by Alexander Bulei
Hi jorgo,

Only one way...by using iwtimer...

WebApplication.CallBackResponse.AddJavaScriptToExecute( 'ActiveLock();' );

Sleep(5000);

WebApplication.CallBackResponse.AddJavaScriptToExecute( 'ReleaseLock();' );


The server will generate the js code, only after executing the procedure/function...in this case, it will execute 'ActiveLock' and 'ReleaseLock' at same time...so you will not see the results (lock)..

Best Regards,

Re: Is there an alternative way to JQLockIndicator ...

PostPosted: 31 Oct 2016 14:11
by jorgo
Hi Alexander,

IWTimer trick is working.

Ugly sideeffect is, that the form is reloaded after "ReleaseLock".
Is there a fade-in effect for the form?
So it locks like falling into the house with the door (form).

Kind regards

Re: Is there an alternative way to JQLockIndicator ...

PostPosted: 31 Oct 2016 15:30
by Alexander Bulei
Hi jorgo,

Ugly sideeffect is, that the form is reloaded after "ReleaseLock".


What do you mean with reloaded?

I hope you are using IWTimer.OnAsyncTimer event, right?

Best Regards.

Re: Is there an alternative way to JQLockIndicator ...

PostPosted: 03 Nov 2016 12:00
by jorgo
Hi Alexander,

no I don't use the Async Event. If I use it the IWLocker is not shown, and the trick wouldn't work.
I use the synchron IWTimer.OnTimer event.

Kind regards

Re: Is there an alternative way to JQLockIndicator ...

PostPosted: 03 Nov 2016 16:06
by jorgo
Hi,
I have an alternative way to use IWLocker from Intraweb with a cgDevTools button:

Code: Select all
1.) Standard Intraweb button

IWButton1.LockOnAsynchEvent := [aeClick];
Visible := False;

procedure TIWForm1.IWButton1AsyncClick(Sender: TObject; EventParams: TStringList);
begin
   Sleep(5000);
end;


Code: Select all
2.) cgDevTools button

procedure TIWForm1.IWCGJQButton1JQButtonOptionsClick(Sender: TObject; AParams: TStringList);
var
   jsCode : string;

begin
   jsCode := 'document.getElementById(''IWBUTTON1'').click();';
   WebApplication.CallBackResponse.AddJavaScriptToExecuteAsCDATA(jsCode);
end;

Re: Is there an alternative way to JQLockIndicator ...

PostPosted: 03 Nov 2016 17:54
by Alexander Bulei
Hi jorgo,

Check the attached demo ;)

Best Regards.