1 (edited by thezimguy 2018-09-14 07:38:24)

Topic: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Hello Dmitry, Derek and MVD Users,
Please is there an example project on a way to create mdi child forms?

I saw in the functions and class panel TFormstyle:(fsMDIChild,
How do I use it to achieve the MDI Child Form
Regards

@thezimguy

2 (edited by thezimguy 2018-09-14 09:53:42)

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

I have been able to solve it myself using the below code.

procedure Form1_btnF2_OnClick(Sender:TObject; var Cancel:Boolean);
begin
     Form2.FormStyle:=fsMDIChild;
end;
begin
     Fom1.windowState:=wsMaximized;// or set in the properties
     Form1.FormStyle:=fsMDIForm;
end.
@thezimguy

3 (edited by thezimguy 2018-09-15 12:56:32)

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

PROBLEM NO.1
The problem I'm facing now is.....
1. When there are components on Form1(MDIForm) and you open the Form2(MDIChild)...
The Form2(MDIChild) goes behind the components on Form1(MDIForm).
2. Also if I try to close a MDIChild Form it minimizes instead of closing the MDIChild form
Any fix?
Regards

@thezimguy

4 (edited by thezimguy 2018-09-14 09:54:16)

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

PROBLEM NO.2


procedure Form1_btnF2_OnClick(Sender:TObject; var Cancel:Boolean);
begin
     Form2.FormStyle:=fsMDIChild;
end;

procedure Form1_btnF3_OnClick(Sender:TObject; var Cancel:Boolean);
begin
     Form3.FormStyle:=fsMDIChild;
end;
begin
     Form1.windowState:=wsMaximized;// or set in the properties
     Form1.FormStyle:=fsMDIForm;
end.

Issue:
1. Run program
2. Click on button (btnF2) to show MDIChild Form(Form2)
3. Click on button (btnF3) to show MDIChild Form(Form3)
4. Click on button (btnF2) again

After clicking on the last button, I was expecting the MDIChild Form(Form2) to get focused but MDIChild Form(Form3) is still on top

Any fix?
Regards

@thezimguy

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Download example project

Post's attachments

Attachment icon MDIForm.zip 333.3 kb, 128 downloads since 2018-09-14 

@thezimguy

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Also, how do I prevent my application from showing multiple open windows in the task bar

@thezimguy

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Thank you thezimguy for the example project.
I wish to get answers for the subsequent questions
Thanks

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

thezimguy wrote:

PROBLEM NO.1
The problem I'm facing now is.....
1. When there are components on Form1(MDIForm) and you open the Form2(MDIChild)...
The Form2(MDIChild) goes behind the components on Form1(MDIForm).

You can't change it. It should be.


thezimguy wrote:

2. Also if I try to close a MDIChild Form it minimizes instead of closing the MDIChild form
Any fix?
Regards

It's standard behavior for child forms, but you can change it

procedure Form2_OnClose (Sender: TObject; Action: string);
begin
    Form2.FormStyle:=fsNormal;
end;

// how to open again
procedure btnF2_OnClick(Sender: TObject; var Cancel: boolean);
begin
    Form2.FormStyle:=fsMDIChild;
    Form2.Show;
    Form2.WindowState := wsNormal;
end;
Dmitry.

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

thezimguy wrote:

PROBLEM NO.2


Issue:
1. Run program
2. Click on button (btnF2) to show MDIChild Form(Form2)
3. Click on button (btnF3) to show MDIChild Form(Form3)
4. Click on button (btnF2) again

After clicking on the last button, I was expecting the MDIChild Form(Form2) to get focused but MDIChild Form(Form3) is still on top

Any fix?
Regards

Please download latest beta version:
https://www.dropbox.com/s/yagi074bd24ox … a.zip?dl=0



I added method BringToFront for form

procedure btnF2_OnClick(Sender: TObject; var Cancel: boolean);
begin
    Form2.FormStyle:=fsMDIChild;
    Form2.BringToFront;

end;

procedure btnF3_OnClick(Sender: TObject; var Cancel: boolean);
begin
    Form3.FormStyle:=fsMDIChild;
    Form3.BringToFront;
end;
Dmitry.

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

thezimguy wrote:

Also, how do I prevent my application from showing multiple open windows in the task bar

Unfortunately I don't know how to change it.

Dmitry.

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

This is great. Good to know that it's possible to make those changes.
I really appreciate your kind gesture Dmitry.

@thezimguy

12 (edited by thezimguy 2018-09-21 14:59:10)

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Hello Dmitry, Derek and MVD users,
Possible bug during design form
https://i.postimg.cc/43CSP4w3/form.png

During the design of the form
1. I enlarged the form height and width so I was scrolling during the design
2. I decreased the height and width of the form but parts of the form( top and left) is no more visible for editing
See attached image
Thank you in advance

@thezimguy

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Thank you for the bug report, I know about this bug.

Dmitry.

14 (edited by thezimguy 2018-09-21 15:32:01)

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Again Dmitry,
Please will it be possible to have multiple tabs for the script for easy working in the code?

Example
If I have two forms (Form1 & Form2)
I want to create two script tabs,  one for Form1 and the other for Form2
There can also be a general script tab
Apparently, I have been using the key word 'uses' to include individual scripts into the project and do the coding in vscode Editor.
I think it will be very handy if we can code the in MVD.
Thank you

@thezimguy

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

Yes, it's nice idea, I have already think about it, I believe that I will implement it in the future.

Dmitry.

Re: [SOLVED] MVD Form (MDIForm & MDIChild Forms)

@theZimGuy -  Is this a Point Of Sale project you're working on?  From your screenshot I took a look and at a
glance it appears to be.  Please let me know because I'm interested on developing one using MVD.

Cheers!