?
Solved

About MDI (Question 1)

Posted on 1997-12-20
9
Medium Priority
?
278 Views
Last Modified: 2010-04-04
I tried to add a TabSet to my MDI application and I want it in such a way that when I click on the TabSet, the corresponding MDI Child Window will be shown.

But I've noticed that the TabSet's Index and the MDIChildren array does not correspond (i.e. the index 0 in MDIChildren refers to the active Child Window but the index 0 in TabSet refers to the first Tab)

How do I solve this??

0
Comment
Question by:WizKid
[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
  • 5
  • 4
9 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 160 total points
ID: 1354269
What you can do is this : Name your tab to the name of your child menu. If the tab is triggered you can call this code :
  ChildIndex := 0
  while (ChildIndex < frmMDIParent.ChildCount) and
        (frmMDIParent.MDIChildren[ChildIndex].Name <>
         {TabName}) do Inc(ChildIndex);
    if ChildIndex <> frmMDIParent.ChildCount then begin
          frmMDIParent.MDIChildren[ChildIndex].BringToFront;
    end;

But normally if give the same index of your child to the corresponding tabindex it would offcourse be easier, but it looks like you've already tried that out :

 frmMDIParent.MDIChildren[TabIndex].BringToFront;

Besides, normally the index of the active MDIChild can be found with ActiveMDIChild! And I don't think it's always index 0!!

Have fun,
c.u. ZifNab;

0
 

Author Comment

by:WizKid
ID: 1354270
My Child doesn't have a menu...
So any other way??
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1354271
Sorry, my mistake (how the hell to I come to menu???) Just call the tab to the name of your child name! Or define an array, where the corresponding numbers (tabs) have the name of your child.
Or just use something where you can store the name of the child to the corresponding tabindex. With the first example, you search through the list of names, if you found it you can go to the corresponding tabpage.
Doesn't example 2 works????
0
Technology Partners: 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 8

Expert Comment

by:ZifNab
ID: 1354272
Hi WizKid,

look at this sample code :

http://torry.rimini.com/samples/samples/mddi1097.zip;

Sample of MDI with tabset, flickerless, ....

All what you need.

Merry X-Mas & Happy New Year!
Have fun,
c.u. ZifNab;
0
 

Author Comment

by:WizKid
ID: 1354273
Have already seen his sample code but it causes a runtime error when I click on my close all button

The piece of code for my close all procedure is as follow
procedure CloseAll;
var
  i : integer;
begin
  for i:=MDIChildCount-1 downto 0 do
    MDIChildren[i].Close;
end;
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1354274
Have you put this into the OnClose event of the Childform('s)?

 Action := caFree;

This has to be done!.
0
 

Author Comment

by:WizKid
ID: 1354275
I've already done that...
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1354276
When do you get the error?
At which i value? At beginning or end?
0
 

Author Comment

by:WizKid
ID: 1354277
I've solve it already...
Thanks for helping me all along :-)

WizKid
email: wenwei@mbox2.singnet.com.sg
webpage: http://web.singnet.com.sg/~wenwei/index.html

0

Featured Post

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!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

801 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