Game Development Community

Borland Builder VCL question

by Joshua "The Power Nap" Taylor · in Technical Issues · 07/17/2001 (8:37 am) · 5 replies

Just a quick vcl question,

How do you get muiltiple forms to talk together? I'm building a MDI in vcl and i've run into this problem. I can get a new form, but I can't get any communication between them.

#1
07/17/2001 (10:00 am)
Well what are you trying to do now? There are more than a couple ways of getting forms to talk. One is using windows messages, or you could use the MDI parent as a dispatcher, or set direct references from within the forms themselves. That's assuming you're talking about getting multiple MDI children to talk to each other.

In short, give us a little more information about what you're trying to do.
#2
07/18/2001 (6:12 am)
Assuming this is a true MDI application, the parent form has a listing of all MDI child forms. If you know the name of a form you can flip through this list of child forms until you reach the desired form.
#3
07/19/2001 (3:04 pm)
I'm trying to set up child forms that send data to the parent form. I know the answer is simple, but finding info on VCL is a bit harder than it is on MFC. What I want to do is have the parent form launch/make visable the child form. Most if not all the stuff I need to do is of this depth, I don't need the children to talk to one another. I'll have an object that the child will send data to, so I don't think that it will have to send data back to the parent form. If you need more info let me know.
#4
07/19/2001 (4:39 pm)
You start off by saying "I'm trying to set up child forms that send data to the parent form", but then end with " I don't think that it will have to send data back to the parent form". Which is it? Or are you talking about two different situations?

The simplest form of inter-object communication is always direct function calls, which all you need for is a pointer to the reciever. So give the child a pointer to the object it's supposed to talk to, and call away.

If you're talking about actual windows messages (WM_MESSAGE type stuff), VCL wraps most of them nicely in function calls. So to show a form, instead of sending it a WM_SHOW message, just call it's Show() method. The help files contain all the info you need.
#5
07/20/2001 (7:28 am)
"child forms that send data to the parent form"

Very simple in fact.

Just make sure your child form has the header for the Main form. Then you can use the main forms functions like Scott said, MainForm->Show();
Of course you can add your own functions to the main form and call them the same way.

Take a look in the examples directory, there is a sample MDI application in there that should show you what you need.