Page 1 of 2

Lock indicator timeout when app not responding

PostPosted: 23 Jan 2014 08:13
by George
Good afternoon!
  • Why lock indicator closes if server app not responding at all (terminated)?
  • Lock indicator not work with AjaxHistory - is it limitation or bug?

Re: Lock indicator timeout when app not responding

PostPosted: 23 Jan 2014 11:20
by Jorge Sousa
Hello

Fot both topics we need a demo.

Re: Lock indicator timeout when app not responding

PostPosted: 24 Jan 2014 12:31
by George

Re: Lock indicator timeout when app not responding

PostPosted: 04 Feb 2014 15:04
by George
up

Re: Lock indicator timeout when app not responding

PostPosted: 05 Feb 2014 11:15
by Jorge Sousa
checking....

Re: Lock indicator timeout when app not responding

PostPosted: 05 Feb 2014 11:51
by Jorge Sousa
Hello

Regarding to the first part: the OnHashChange event.

First you've to realize that setting LockIndicator.AsyncIndicatorIndex <> -1 it's a global configuration to most clickable events.

The best way to set lockindicator to events is doing it specifically, using Event.Indicator and Event.IndicatorIndex like demonstraded in this post:

http://www.cgdevtools.com/cgforum/viewtopic.php?f=102&t=382

That said, and having checking Intraweb javascript code, we find out that if there are no changed controls the javascript code never calls the indicator code :o !!!!

So while we don't create an internal work around to this, you can do this in your first button click.

procedure TIWForm8.IWCGJQButton1JQButtonOptionsClick(Sender: TObject; AParams: TStringList);
begin
IWCGJQAjaxBrowserHistory1.AddHash('test');
CGAddJavaScriptToAjaxResponse('AddChangedControl("dummy");');
end;

I'll be back to you soon for the 2nd part.

Re: Lock indicator timeout when app not responding

PostPosted: 05 Feb 2014 11:55
by Jorge Sousa
the 2nd part, the 2nd button, I don't understand at all what you mean, please report.

Re: Lock indicator timeout when app not responding

PostPosted: 05 Feb 2014 14:50
by George
Hello!

I specially added this line:
delphi code
procedure TIWCGJQFrame1.IWCGJQFrameCreate(Sender: TObject);
begin
Sleep(5000);
end;

If i click button 2, then load indicator will be visible all time while frame is loading (creating). In example, frame need 5 seconds.
Sleep emulates heavy frame create code or frame with big amount of contros.

CGAddJavaScriptToAjaxResponse('AddChangedControl("dummy");');

Yes, lock indicator now appears, but closes too early.
If we apply, that 5 sec pause emulates slow internet connection speed,
user clicks to button and nothing happening for 5 seconds in sample.
And user will be sure, that nothing happening at all and everything is broken)

the 2nd part, the 2nd button, I don't understand at all what you mean, please report.

Run server "Project3.exe",
open session in web browser,
close process Project3.exe (for example: internet connection lost or server goes on maintenance),
press second button, you will see, that lock indicator opens and closes shortly.
I'm not sure, but i think will be better if lock indicator will be shown permanently in this case.
Or, may be better to add javascript message window when async methods cannot be executed (when server not responding)?

Re: Lock indicator timeout when app not responding

PostPosted: 05 Feb 2014 19:33
by Jorge Sousa
Hi George

I understood why you're calling a Sleep

Yes, lock indicator now appears, but closes too early.


As I said you must explicitely set the Indicator and IndicatorIndex of OnHashChange event, because it's not a common clickable event.

Code: Select all
  object IWCGJQAjaxBrowserHistory1: TIWCGJQAjaxBrowserHistory
    Version = '1.0'
    OnHashChange.BrowserParams = <
      item
        ServerName = 'Hash'
        BrowserScript = 'hash'
      end>
    OnHashChange.Ajax = True
    OnHashChange.OnEvent = IWCGJQAjaxBrowserHistory1HashChange
    OnHashChange.Indicator = IWCGJQLockIndicator1
    OnHashChange.IndicatorIndex = 0
    Left = 128
    Top = 365
  end


About the 2nd part

I'm not sure, but i think will be better if lock indicator will be shown permanently in this case.
Or, may be better to add javascript message window when async methods cannot be executed (when server not responding)?


The LockIndicator it's attached to Intraweb ajax code, we also think that a javascript message should appear, but as you can see, the IWAjax code for function SendPostRequest is this one:

Code: Select all
 var status = AjaxRequest.submit(
xSubmitForm, {
'onSuccess':function(req)
{
var xmldoc;
xmldoc = loadAjaxResponse(req.responseText);
processAjaxResponse(xmldoc);
if (PostAsyncScript == true) {
PostAsyncProgressScript(eventParams,aCallback);
}
processEventQueue();
window.eventProcessing = false;
}
,'onError':function(req) {
if (PostAsyncScript == true) {
PostAsyncProgressScript(eventParams,aCallback);
}
window.eventProcessing = false;
if (req.responseText == "") {
window.serverProblem = true;
} else {
var doc = window.document.open("text/html","replace"); // create a new document and write the response to that page
doc.write(req.responseText);
doc.close();
}
logMessage('Ajax-Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);
}
}


Ie, if there is an error (
for example: internet connection lost or server goes on maintenance)
, it calls

logMessage('Ajax-Error!\nStatusText='+req.statusText+'\nContents='+req.responseText);

we should be able to define how logMessage is handled, but this was not implemented in Intraweb, afawk.

Re: Lock indicator timeout when app not responding

PostPosted: 06 Feb 2014 07:40
by George
As I said you must explicitely set the Indicator and IndicatorIndex of OnHashChange event, because it's not a common clickable event.

Sorry, i missed this.
Thanks)) Now works with buttons.

That said, and having checking Intraweb javascript code, we find out that if there are no changed controls the javascript code never calls the indicator code :o !!!!
So while we don't create an internal work around to this

Should i create ticket in tracker?
Not possible to call "CGAddJavaScriptToAjaxResponse('AddChangedControl("dummy");');" when user press back button or input url manually...