Page 1 of 2

Best practices

PostPosted: 07 May 2015 12:04
by Soren SDF
Hi.

I'm working on a new application that relies heavily on dialogs.
I have a main form show a couple of grids and depending on which grid i select a row in i want pop up a different dialog. To make things more complicated i also want to be able to show a dialog when i click a button on the dialog. I may also want to open a third dialog from the second one. etc etc. I would prefer to have the different dialogs reside in their own .pas files.
Is this possible, or could there be potential problems?

Regards
Sören

Re: Best practices

PostPosted: 07 May 2015 16:35
by Jorge Sousa
Hi Sören

I don't see no reason for not using multiple dialogs stacked.

Re: Best practices

PostPosted: 08 May 2015 12:55
by Soren SDF
One problem i have is how to close the dialog with a custom button.
Rather than clicking the X icon i want to have my own button executing some code before i close the dialog.
I can execute the code but the dialog wont close.
I have tried setting MyDialog.Visible:=False and MyDialog.JQDialogOptions.Close but neither seems to work.
It closes fine with the X though.

Sören

Re: Best practices

PostPosted: 08 May 2015 14:13
by Jorge Sousa
Hi Sören

You've to send us a test case because we cannot reproduce any of these

Re: Best practices

PostPosted: 08 May 2015 19:46
by zsleo
I have had the same problem many times. Especially with stacked and reused dialogs.

The only solution I found is to add a line of code after calling close or hide: ProcessCommand (0);

Regards

Re: Best practices

PostPosted: 10 May 2015 12:32
by Soren SDF
Im not sure what you mean by ProceesCommand(0). Where is that declared?
I'll try to make a test project to demonstrate the problem and post it in this thread.

Soren

Re: Best practices

PostPosted: 11 May 2015 03:35
by zsleo
It is declared in IWCGFrame.

You can also add the following private procedure to a unit and call ProcessCommand(0, nil):

procedure [T_Form_or Frame_Class].ProcessCommand(ACommand: Integer; AParams: TStrings);
begin
{ }
end;

Re: Best practices

PostPosted: 11 May 2015 08:41
by Soren SDF
OK. So this could be a clue maybe?
I have created a TIWAppForm and put the dialog on it. Is that a problem?
Is the recommended method doing this on a frame?

Sören

Re: Best practices

PostPosted: 11 May 2015 15:20
by ScottWGast
The main problem that I've had with stacked, modal dialogs is ensuring that the z-index value for each dialog layer (including all of the editable components) is incrementally higher on each subsequent dialog.

Scott

Re: Best practices

PostPosted: 11 May 2015 16:49
by Jorge Sousa
Hello all

I just uploaded a demo that demonstrates how to do this, the secret is the Frame's ownership and name. Intraweb has an old bug, if you create a frame owned by a frame, it doesn't create an unique HTML ID. Besides this, the Parent of the dialog's frame must always be the IWForm.

We don't need to adjust the ZIndex for the dialog, only for the controls in the dialog. The Dialog's ZIndex is automatically adjusted by jQueryUI itself (if JQDialogOptions.Stack = True, defauly value).

I hope it helps.