Solved

About MDI (Question 1)

Posted on 1997-12-20
9
272 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
  • 5
  • 4
9 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 40 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How to fill array with TArray.Create? 14 90
indy Tmemory stream non latin charcter issue 2 112
how to center only a line in richedit? 4 58
Multi-layered image in FireMonkey 9 37
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

803 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