Solved

passing parameters between MDI windows

Posted on 1998-10-10
6
231 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now