Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

How to add a tab control as a window selector?

Hello all,
    I'm a delphi newbie, I'm trying to add a tab control on the top of a mdiform, it's a window selector, it acts like the window menu.
    But i have no ideas how to implement. I have too many forms in a project, so i cannot write codes in each form to add a tab or remove the tab when it's loaded or unloaded, i think it must be a excellent way to do this, how?
   Thanks!!
0
prefix
Asked:
prefix
  • 7
  • 5
1 Solution
 
Stuart_JohnsonCommented:
So, what you want is a TabControl on the top of the main MDI form, and when a new MDI Child is created, a new Tab is added, or if the MDI Child is destroyed, the tab clears?

And, if you click a tab, that form gets focused, or if you bring a form to the front manually, the corresponding tab is made active?

Does that sound right??

Stuart.
0
 
prefixAuthor Commented:
yeah, that's actually what i want.
0
 
Stuart_JohnsonCommented:
OK.  Done.

I'll give you a link as soon as I've uploaded it.

Stu
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Stuart_JohnsonCommented:
OK, you can download it here.  I've included a demo EXE in the zip file just so you can see what it does first.

http://users.on.net/jonstu/ee_mdi_project.zip

Please don't accept this as an answer unless it solves your problem.  I may not be right and I'd prefer others to be able to answer you if I'm wrong.

Cheers,

Stuart.
0
 
prefixAuthor Commented:
Thank Stuart. The projects is what I'm talking about. But it's not so useful for me because I have too many MDIChilds in the project, so I cannot add codes to each child form. It will takes much time to finish the work and I also have to add such codes if I add new MDIChilds.
0
 
Stuart_JohnsonCommented:
You dont have to add any new code to the forms which is why I wrote the demo that way.

Instead of creating the forms the traditional way (Form = TForm.Create(owner)) just call the StartTheForm procedure.
0
 
Stuart_JohnsonCommented:
To be honest, I can't think  of any other way you will be able to do it without adding some code somewhere.  What I've shown you is the most simplistic way of doing it.
0
 
Stuart_JohnsonCommented:
Do you understand what I mean?  I can help you more if you like.
0
 
prefixAuthor Commented:
oh...yes, you're right! Now i understand. Thank you!
0
 
Stuart_JohnsonCommented:
No problems at all!  Glad to have been able to help.

Stu
0
 
prefixAuthor Commented:
Hi Stuart, I back again, in the example, the CloseMDIChild substiutes the OnClose event, but I found there I need to write something in the OnClose Event, like Form2 := nil, Form3 := nil, in this case, how to solve this issue?
0
 
prefixAuthor Commented:
oh, i've found a way, use a pointer instead of the formname.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 7
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now