?
Solved

passing parameters between MDI windows

Posted on 1998-10-10
6
Medium Priority
?
243 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

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!

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
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…
Suggested Courses
Course of the Month7 days, 23 hours left to enroll

765 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