Solved

passing parameters between MDI windows

Posted on 1998-10-10
6
237 Views
Last Modified: 2010-04-06
I have an MDI application.  One of the capabilities is to create MULTIPLE windows of type SQL_Form.  Within SQL_Form, the user may drill down to show additional information, spawning off a SQL_DETAILS window, also MDI.  

I need to pass information between the SQL_FORM window and ONLY the SQL_DETAIL window that it owns.  This information is only transferred once when I create the SQL_DETAIL window.

It's NOT a back and forth communications.  It basically sets up some environmental type information. (text strings that go into edit boxes, etc..)

I started off with global variables, but realized I really don't want to do that way.

So in summary, how does one MDI child window pass information to an MDI child window that is just created, or even pass the information during the create process?

Thanks
George Spears
0
Comment
Question by:gspears060598
[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
6 Comments
 

Author Comment

by:gspears060598
ID: 1342489
Edited text of question
0
 
LVL 3

Expert Comment

by:Matvey
ID: 1342490
I can think of:

1) Messages sent to the windows using SendMessage or whatever.
2) Variables. Don't know why you don't like this way. You can pass variables even between several applications, not only windows the belong to your application.
0
 

Author Comment

by:gspears060598
ID: 1342491
Here's my concern:

Assume I have four copies of SQL_Form, X1, X2, X3, X4.
Each one of those spawn off a child window, Y1, Y2, Y3, and Y4.

If I have a global set of variables for SQL_Form, I can't ensure that when Y2 is looking at the variables, that X2 is the window that set the variables.

X1 sets variables for Y1, X2 for Y2, X3 for Y3, X4  for Y4, etc.
With just a single set of global variables, I think I am asking for trouble trying to keep things coordinated.

If I'm missing something using Global variables, let me know...

Thanks


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 10

Expert Comment

by:ptmcomp
ID: 1342492
I can't already exactly unterstand wich type of information you have to exchange between your MDI Forms. But I've a few suggestions:
- Use Callback procedures or properties
- Create a TSQL_DETAIL form and override the constructor, so you can e.g. submit a record. Like this you can create the form and pass the information at once:

type
  TInformation= record
     FirstInfo: Integer;
     ...
  end;
var
  SQL_DETAIL: TSQL_DETAIL_From;
  Information: TInformation;
begin
  SQL_DETAIL_Form:=TSQL_DETAIL_Form.Create(ParentForm, Information);

Is this what you are expecting?

Sorry - English is not my native language.

0
 
LVL 3

Expert Comment

by:Matvey
ID: 1342493
Yeah, propably somthing like this is the easiest thing to do. What is it you're doing exactly?

If it's possible to think of these variables as something that describes some state of some object, then you can use a property for each object... I'm really having trouble to understand, guess ptmcomp too, so try maybe to explain carefully again.

Sorry, Matvey
0
 
LVL 2

Accepted Solution

by:
Thaddy earned 20 total points
ID: 1342494
A simple and imho elegant solution is to make the new MDI child window the child of the 'owning' mdi window. (NOT the owner, that's impossible) There are a couple of provisions to make:
It's better NOT to nest the forms too deep

Suppose the following:
You design three form classes:
The Mainform (Auto created)
The Subform  (Created on demand), with a property of type TSubSubform and in this example an editbox.
The SubSubForm (Created by the subform, on demand) like:
 
With TSubSubform.create(self{firstinstance of mdichild creates second one}) do
begin
  Parent:=Self;
  //do your stuff
  //Caption:='I''m the Child';
  //(Parent as Tform).Caption:='I''m the Parent';
end;

You can now transparently transfer information between related formpairs with constructs like:

MySubSubform.info:= Edit1.text;

etc, etc.
*********important!**********
Note that the close action for the subsubform can't be caFree!,
You first have to remove it from the Subform's Componentlist.
The Sub formclass can have a close action of caFree. It will then
Automatically release the SubSubform instance associated with it.
*****************************************************************

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

Suggested Solutions

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…

749 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