MDI File Question

Started by JR Heathcote, February 24, 2006, 10:36:47 AM

Previous topic - Next topic

JR Heathcote

How does one go about adding a Tab control to the main MDI form in Firefly?

TechSupport

In the current version of FireFly it is not as easy as it should be because you can not create child controls ont he MDI form (like VB). However, there is a workaround for this:

Create a Form (frmTab) and set it as a WS_CHILD.

Create your TabControl on this form.

Set the "AutoSizeClient" property for the MDIForm to "False".

In the WM_CREATE of the MDIForm:
frmTab_Show hWdnForm, %FALSE

In the WM_SIZE message for the MDIForm, reposition the controls and MDIClient area manually.

I have created a sample project that does this. I will email it to you.

TechSupport

Just as an aside, I never use MDI in my applications anymore. It appears that Microsoft is using less and less MDI styled applications these days. Visual Studio for example uses a tab control across the top that allows the user to navigate among windows (which are simply WS_CHILD forms rather than MDI children). I use the same approach in FireFly. You can easily show the correct window by responding to the tab control change and using SetWindowPos to bring the correct child window to the top of the zorder.

JR Heathcote

Thanks.  Actually the scenario you described with Firefly is exactly what I want for my civil engineering app.  Will give the WS_CHILD forms a try.

TechSupport

I just emailed the project to you..... hopefully it makes sense. Any problems, just let me know.

TechSupport

Quote from: JR HeathcoteThanks.  Actually the scenario you described with Firefly is exactly what I want for my civil engineering app.  Will give the WS_CHILD forms a try.

Yes, doing it this way enables you to bypass having to deal with the MDIClient window and having to deal with the MDI maximize, restore, minimize stuff. You simply create one main form (frmMain) and then as many child forms as you need and display them using a single generic routine. For example, frmMain_ShowWindows You would call that function whenever you need to reposition the child windows (e.g. during the WM_SIZE message for the main form). The child window to display would be dependant on which Tab is currently selected in the tab control.

tom cone jr

Would it be asking too much for a simple example to be worked up and posted in the source code forum?

-- tom

TechSupport

I will create an example and upload it to the website. It would be too much for a simple posting.

JR Heathcote

Thanks, I would like to see the demo as well.


JR Heathcote

Thanks for the demo, I can breath again.