?
Solved

How to add a tab control as a window selector?

Posted on 2003-03-13
12
Medium Priority
?
202 Views
Last Modified: 2010-04-04
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
Comment
Question by:prefix
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
12 Comments
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8133670
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
 
LVL 1

Author Comment

by:prefix
ID: 8133754
yeah, that's actually what i want.
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8133765
OK.  Done.

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

Stu
0
Independent Software Vendors: 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!

 
LVL 6

Accepted Solution

by:
Stuart_Johnson earned 500 total points
ID: 8133795
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
 
LVL 1

Author Comment

by:prefix
ID: 8133870
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
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8133923
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
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8133928
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
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8133977
Do you understand what I mean?  I can help you more if you like.
0
 
LVL 1

Author Comment

by:prefix
ID: 8134251
oh...yes, you're right! Now i understand. Thank you!
0
 
LVL 6

Expert Comment

by:Stuart_Johnson
ID: 8134492
No problems at all!  Glad to have been able to help.

Stu
0
 
LVL 1

Author Comment

by:prefix
ID: 8134659
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
 
LVL 1

Author Comment

by:prefix
ID: 8135078
oh, i've found a way, use a pointer instead of the formname.
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question