Solved

About MDI (Question 1)

Posted on 1997-12-20
9
273 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

856 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