Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

About MDI (Question 1)

Posted on 1997-12-20
9
Medium Priority
?
280 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
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!

 
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

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!

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

597 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