CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

Lock indicator timeout when app not responding

by George » 23 Jan 2014 08:13

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?
Last edited by George on 28 Jan 2014 15:10, edited 1 time in total.
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 23 Jan 2014 11:20

Hello

Fot both topics we need a demo.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 24 Jan 2014 12:31

Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by George » 04 Feb 2014 15:04

up
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 05 Feb 2014 11:15

checking....
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Jorge Sousa » 05 Feb 2014 11:51

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.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by Jorge Sousa » 05 Feb 2014 11:55

the 2nd part, the 2nd button, I don't understand at all what you mean, please report.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 05 Feb 2014 14:50

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)?
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

by Jorge Sousa » 05 Feb 2014 19:33

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.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by George » 06 Feb 2014 07:40

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...
Best regards!
George
 
Posts: 486
Joined: 23 May 2013 15:50
Location: Russia, Moscow

Next

Return to JQLockIndicator

cron

Who is online

Users browsing this forum: No registered users and 1 guest

Contact Us.