?
Solved

passing parameters between MDI windows

Posted on 1998-10-10
6
Medium Priority
?
250 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
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
Independent Software Vendors: 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 60 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses
Course of the Month16 days, 15 hours left to enroll

864 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