CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

IWCGMessageDdl

by etwoss » 11 Jul 2014 09:27

Hi

I have a method like this one:

Code: Select all
var
  Button: TIWCGJQCustomButton;
  LCancelOrderID : Integer;
  LCancelOrderDesc : String;
  LRowIndex : Integer;
begin
  Button:= (Sender as TIWCGJQButtonOptions).Button;
  LRowIndex := Button.Tag;
  GridOrderItems.JQGridOptions.SetSelection(LRowIndex);

  LCancelOrderID   := StrToInt(GridOrderItems.JQGridProviderCells.CellValue[0, LRowIndex]);
  LCancelOrderDesc := GridOrderItems.JQGridProviderCells.CellValue[3, LRowIndex];

  IWCGMessageDlg(Format('Are you sure you want to cancel request %d for product "%s" ?',[LCancelOrderID,LCancelOrderDesc]),mtConfirmation,[mbYes,mbNo],
    procedure(Dialog: TIWCGJQMsgDialog; AResult: TModalResult)
    begin
      if AResult = mrYes then
      begin
        //WebApplication.Lock;
        try
          OrderItems.CancelOrder(LCancelOrderID, UserSession.IMSession);
          GridOrderItems.JQGridProviderCells.Rows.Delete(LRowIndex);
          ReloadGrid(GridOrderItems);
        finally
          //WebApplication.Unlock;
        end
      end;
    end);
end;


If i set a breakpoint at the last "End;" statement of the method it reaches that breakpoint before the dialog is shown.
is this normal behaviour of am i doing something wrong?

Eric
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by Jorge Sousa » 11 Jul 2014 09:50

Hi Eric

If i set a breakpoint at the last "End;" statement of the method it reaches that breakpoint before the dialog is shown.
is this normal behaviour of am i doing something wrong?


Ahah, this is normal, many people make confusion with this, thinking in Windows ShowModal.

IWCGMessageDlg, like all other Intraweb functions, in ajax/async events, it's only translating Delphi to Javascript and queuing it.

the SERVER will not stop to send a message to browser, this would revert the CLIENT-SERVER logic.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58


Return to General

cron

Who is online

Users browsing this forum: No registered users and 18 guests

Contact Us.