Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

MDIChild: Who is my parent?

Posted on 1999-06-25
8
Medium Priority
?
347 Views
Last Modified: 2010-05-18
Is there another way of checking the mdichild's
parent than with a screen.forms[i] loop and check if
the mdichild is in a mdiForm window with another loop?
The mdichild does not have access to the main form
or any other global variable, so it is not possible to
store the MDIForm variable there. The code must run
in the MDIChild's environment.
0
Comment
Question by:cydo
[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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 1384641
midform.parent will do I guess....
0
 
LVL 2

Expert Comment

by:CalvinDay
ID: 1384642
Why do you say that the mdichild does not have access to the main form or any global variable?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1384643
hi cydo,

just add the mdiMainform Unit after the implemantation part like

unit mdichild;

uses
...
Interface
...

implementation

uses MDIMainForm;

....

end.


Now you can easliy access global defined vars and the mainform itselfs,

meikl
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:cydo
ID: 1384644
The mdichild does not have access to the main form
or any other global variable... because it is a
component which will be dropped on the mdiChild.
That means I can not use any "uses" declarations nor
any variables declared in the mainform .
This component dropped on the MDIChild needs to know the MDIForm's
size etc.

and MDIChild.Parent = NIL ...
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1384645
hi cydo,

its just the same

unit mdichild;
uses
...
Interface
...

implementation

uses MDIMainForm;
//holds for example the Form-Object named TMDIFORM with the global var MDIFORM : TMDIFORM


in your onCreateEvent of your Childform:

Begin
  MySpecialComponentWidthProperty := MDIFORM.Width;
  MySpecialComponentHeightProperty := MDIFORM.Height;

and so on
end;

....

end.

well, of course, this can only done in RunTime, not in DesignMode

meikl
0
 

Author Comment

by:cydo
ID: 1384646
thanks kretzschmar for your help, but i can NOT modify the mainform's (mdiform) unit, just because i do not have access to it. I do not know (at design time nor runtime) the MDIForm (otherwise I would use a global var as you proposed).

I am writing a component, which will be placed on any MDIChild form.
This component now needs informations about the MDIForm in which this MDIChild resides (on which i placed my component). So I started doing a

for i:= 0 to screen.formscount do
 if screen.forms[i].fsstyle=mdiform then
  for j:= search in this form if my MDIChild form is in this MDIForm

But as I am going to have many windows, this isn't an appropriate solution.
And the MDIChild.Parent = NIL
As with a MDIForm there is this MDIchilds property so i thought there may be the other way round, too (a MDIParent property in a MDIChild-form).


0
 
LVL 13

Accepted Solution

by:
Epsylon earned 300 total points
ID: 1384647
Use Application.MainForm
0
 

Author Comment

by:cydo
ID: 1384648
Oh, that easy ;)
That works fine, thanks
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses

730 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