Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 9 of 9 total
Thread ShowProgress Issue
Mon, Aug 24 2015 5:32 PMPermanent Link

squiffy

Telemix Ltd.

Avatar

I call ShowProgress('...') before an AJAX request is fired off.
In the complete routine, I call HideProgress (which seems to work) then check the result code and act accordingly.

There are three results from my ajax call.
On 200 I load some data into a grid.
On 401 I display a modal form which informs them they need to log in and presents them with a button to click as well as instructions to F5 or CMD-R if that doesn't work.
On anything else I display a showmessage box just for the time being (debug purposes).

Now - without the ShowProgress all the above works perfectly.

With the ShowProgress, the 200 and the "other" responses work fine, but the 401 response which shows the modal form is odd. It shows the form but does not give it focus and I cannot click on it. I assume this is somehow related to the show progress dialog - any pointers as to what this could be?
Tue, Aug 25 2015 3:47 AMPermanent Link

Eivind

I can confirm I have run into the same issue several times too. The modal dialog can only be clicked with the enter key on the keyboard, not the mouse. Think I solved the problem by calling HideProgress before I  call ShowMessage(). If not the overlay got stuck over my message dialog

Eivind
Tue, Aug 25 2015 5:20 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Hi - the issue is not with the ShowMessage() dialog - that's fine.
My issue is when I show a modal form with MyForm.ShowModal;
That said - you are correct in that I can press the one  and only button on the modal form by pressing ENTER.
HideProgress before the ShowModal doesn't make any difference.

Here's the calling code that shows the progress dialog :
procedure TfrmClientList.refreshDataFromDB(Sender:TObject);
var
  sTmp:String;
begin
  ShowProgress('Loading clients ...');
  srClients.URL:='/clients';
  sTmp:='token='+getToken;
  srClients.RequestContent.Clear;
  srClients.RequestContent.Add(sTmp);
  srClients.RequestHeaders.Add('Content-Length: '+IntToStr(length(sTmp)));
  srClients.Method:=rmPost;
  srClients.Execute;
end;

and here's the code that closes it and shows the modal form :

procedure TfrmClientList.srClientsComplete(Request: TServerRequest);
begin
  HideProgress;
  case Request.StatusCode of
  200:
     begin
        dsClients.Open;
        dsClients.LoadRows(Request.ResponseContent.Text);
        Grid1.Dataset:=dsClients;
     end;
  401:
     begin
        frmAuthFail.ShowModal;
     end;
  else
     begin
        ShowMessage('Bad :' + IntToStr(Request.StatusCode)+', '+Request.StatusText);
     end;
  end;

end;
Tue, Aug 25 2015 2:47 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

squiffy wrote:

<< With the ShowProgress, the 200 and the "other" responses work fine, but the 401 response which shows the modal form is odd. It shows the form but does not give it focus and I cannot click on it. I assume this is somehow related to the show progress dialog - any pointers as to what this could be? >>

Can you send me an example of this ?  I just tried to reproduce this here, and it works fine using a simple setup like this:

unit Unit1;

interface

uses WebCore, WebUI, WebForms, WebCtrls, WebBtns, WebComps;

type

  TForm1 = class(TForm)
     Button1: TButton;
     Timer1: TTimer;
     procedure Timer1Timer(Sender: TObject);
     procedure Button1Click(Sender: TObject);
  private
     { Private declarations }
  public
     { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses Unit2;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
  Form2.ShowModal;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  ShowProgress('Doing something...');
end;

end.

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Thu, Aug 27 2015 4:02 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

(been out of office - will try this tomorrow).
Fri, Aug 28 2015 8:25 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Hi Tim,
see attached project. Simple reproduction of the problem.

Click the button on Form1 -
- shows the progress dialog.
- fires off an AJAX request (that will obviously fail)
- the OnComplete event fires
- HideProgress is called
- show modal window is called

The modal window is greyed out and you can't click the button with the mouse.
If you don't try and click with the mouse then you can press enter to click the button on the modal form.

Remove the show progress and all is well.

Hope this helps.



Attachments: timtest.zip
Fri, Aug 28 2015 5:59 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

The issue was the HideProgress call, which I wasn't using in my tests.  The problem is related to the way ShowProgress/HideProgress work - they are currently *always* scheduled in the UI so that they can be displayed during application startup.  This causes issues when you directly call them while the application is running because dialogs can be executed out-of-order, which messes up the modality.

I'm working on a fix for this for B3.

Tim Young
Elevate Software
www.elevatesoft.com
Sat, Aug 29 2015 3:37 AMPermanent Link

squiffy

Telemix Ltd.

Avatar

Thanks.
Is there a workaround, or do I just wait for the fix? It's hardly a show stopper.
Mon, Aug 31 2015 9:42 AMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

<< Is there a workaround, or do I just wait for the fix? It's hardly a show stopper. >>

You'll have to wait for the fix - the changes are scattered around in a few places in the WebForms unit.

Tim Young
Elevate Software
www.elevatesoft.com
Image