Simulating Clicking TIWCGJQDialog button

I'm trying to "click" the Save button on "myDialog" from within the CGFrame that resides on the dialog:
I call Self.SimulateSaveButtonClick from a button that resides on the CGFrame:
This is the event attached to the dialog's "Save" button OnClick.OnEvent:
Any clue as to why the dialog is not closing? Everything works great if I actually click the "Save" button.
Thanks!
Scott
I call Self.SimulateSaveButtonClick from a button that resides on the CGFrame:
- Code: Select all
procedure TframeEditContactContract.SimulateSaveButtonClick;
var
i: Integer;
begin
for i := 0 to Self.myDialog.JQDialogOptions.Buttons.Count - 1 do
if (Self.myDialog.JQDialogOptions.Buttons[i].Text = Include.C_DIALOG_BUTTON_CAPTION_SAVE) then
Self.myDialog.JQDialogOptions.Buttons[i].OnClick;
end;
This is the event attached to the dialog's "Save" button OnClick.OnEvent:
- Code: Select all
procedure TframeEditContact.CloseModalDialog(Sender: TObject; AParams: TStringList);
var
dialogPopup: TIWCGJQDialog;
buttonDialog: TIWCGJQCustomDialogButton;
ctChildType: TContactChildDataType;
i: Integer;
begin
// This event is used to close the popup/modal dialog. It does not matter which button (Cancel or Save) is clicked
buttonDialog := (Sender AS TIWCGJQCustomDialogButton);
i := AParams.IndexOfName('ComponentName');
dialogPopup := TIWCGJQDialog(AParams.Objects[i]);
ctChildType := TContactChildDataType(dialogPopup.Tag);
case ctChildType of
ctContactAddress:
begin
if (buttonDialog.Text = Include.C_DIALOG_BUTTON_CAPTION_SAVE) then
Self.FframeEditContactAddress.SaveData
else
Self.FframeEditContactAddress.CancelData;
Self.FframeEditContactAddress.UnInitialize;
Self.RefreshGrid(Self.gridAddresses);
end;
ctContactContract:
begin
if (buttonDialog.Text = Include.C_DIALOG_BUTTON_CAPTION_SAVE) then
Self.FframeEditContactContract.SaveData
else
Self.FframeEditContactContract.CancelData;
Self.FframeEditContactContract.UnInitialize;
Self.RefreshGrid(Self.gridContracts);
end;
ctLinkedDocument:
begin
if (buttonDialog.Text = Include.C_DIALOG_BUTTON_CAPTION_SAVE) then
Self.FframeEditContactLinkedDocument.SaveData
else
Self.FframeEditContactLinkedDocument.CancelData;
Self.FframeEditContactLinkedDocument.UnInitialize;
Self.RefreshGrid(Self.gridLinkedDocuments);
end;
end;
dialogPopup.JQDialogOptions.Close(False);
end;
Any clue as to why the dialog is not closing? Everything works great if I actually click the "Save" button.
Thanks!
Scott