[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

passing parameters between MDI windows

Posted on 1998-10-10
6
Medium Priority
?
247 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
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.

 
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

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.

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

649 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