CGDevTools Forum

Welcome to the Official CGDevTools Support Community Forums.

IWCGCreateMessageDialog

by etwoss » 17 Jul 2014 14:10

Hi

I expected this to compile

Code: Select all
          Dlg := IWCGCreateMessageDialog(FMessageStr, mtConfirmation, [mbYes,mbNo],
            procedure (Sender: TObject; AResult: TModalResult; const AData: TCGVarArray)
            begin

            end);


However is says there is no overload that can be called with these arguments

while

Code: Select all
    procedure ConfirmCancelEntitlement(Sender: TObject; AResult: TModalResult; const AData: TCGVarArray);

    Dlg := IWCGCreateMessageDialog(FMessageStr, mtConfirmation, [mbYes,mbNo], ConfirmCancelEntitlement);


works fine.

Am i doing something wrong?

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

by Jorge Sousa » 17 Jul 2014 14:46

Hello

yes this can happen. you have to fill all the parameters.
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 18 Jul 2014 08:11

Hi

if i use a construction like this, where is the best place to free 'Dlg'?

Code: Select all
          Dlg := IWCGCreateMessageDialog(LMessageStr, mtConfirmation, [mbYes,mbNo],
            procedure(Dialog: TIWCGJQMsgDialog; AResult: TModalResult)
            begin
              if AResult = mrYes then
              begin
                LIMServer := GetServer;
                try
                  LSystemSessionID := LogonAsSystem(LIMServer);
                  LOleVar := CreateUserTask(uttWebAction, utsHigh, UserName + ': Cancel ' + LStopEntitlementDesc, LMessageStr, '', LStopEntitlementID, otAllocation, Ord(qaCancellation), PosID);
                  LIMServer.UserTask.InsertObject(LOleVar, LObjectID, LSystemSessionID);
                finally
                  LogoffSession(LIMServer, LSystemSessionID);
                  DropServer(LIMServer);
                end;

                GridProfile.JQGridProviderCells.CellValue[7, LStopEntitlementRowIndex] := 'Pending';
                GridProfile.JQGridOptions.ReloadGrid;
             end;

          end);

          Dlg.Width := 700;
          Dlg.Height:= 300;
          Dlg.AjaxReRender();
         end;
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 18 Jul 2014 11:09

Hi

Checked it with FastMM, no memory leaks, does this mean it does not need freeing?

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

by Jorge Sousa » 18 Jul 2014 11:41

The best and only place to free the dialog is in JQDialogOptions.OnClose calling WebApplication.ReleaseForm(Self) /* Self being a frame if the dialog it's in a frame, or the Dialog, if this is not in a frame
Best Regards
CGDevTools Develop / Support Team
Home Page: http://www.cgdevtools.com
Jorge Sousa
 
Posts: 4261
Joined: 17 May 2012 09:58

by etwoss » 18 Jul 2014 13:03

Thanks!
etwoss
 
Posts: 1205
Joined: 06 Feb 2014 08:58

by etwoss » 21 Jul 2014 09:13

Hi

I noticed the Close is called because i call Visible := False

is that true?

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

by Jorge Sousa » 21 Jul 2014 09:40

Hi

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


Return to JQDialog

cron

Who is online

Users browsing this forum: No registered users and 4 guests

Contact Us.