 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Nick Alexander Guest
|
Posted: Tue Jan 11, 2005 8:33 pm Post subject: Using variables from other forms |
|
|
This is no doubt one of those Delphi 101 questions, but I am trying to
pass variable values from a parent form to its child when it is
opened, but I can't see the child's variables in the parent form after
I have created the child. (I can see all functions, procedures,
visual components, etc) How do I do this?
|
|
| Back to top |
|
 |
Tom de Neef Guest
|
Posted: Tue Jan 11, 2005 10:19 pm Post subject: Re: Using variables from other forms |
|
|
"Nick Alexander" <nic.alexander (AT) gmail (DOT) com> schreef in bericht
news:4ba6d6f1.0501111233.bfc69d6 (AT) posting (DOT) google.com...
| Quote: | This is no doubt one of those Delphi 101 questions, but I am trying to
pass variable values from a parent form to its child when it is
opened, but I can't see the child's variables in the parent form after
I have created the child. (I can see all functions, procedures,
visual components, etc) How do I do this?
|
Are you trying to do the following (i.e. at run-time)?
procedure form1.someMethod //the parent
begin
form2:=Tform.create; // the child
form2.someVariable:=someValue;
Then your question suggests that the compiler refuses to process the last
line since form2.someVariable is undeclared. If this is indeed your case,
then remember that the scope of variables is limited if they are declared in
other then the public sections of form2's declaration. (Check Help -
private).
If this is not your case, then explain a bit further pls.
Tom
|
|
| Back to top |
|
 |
Jamie Guest
|
Posted: Thu Jan 13, 2005 8:17 pm Post subject: Re: Using variables from other forms |
|
|
Nick Alexander wrote:
| Quote: | This is no doubt one of those Delphi 101 questions, but I am trying to
pass variable values from a parent form to its child when it is
opened, but I can't see the child's variables in the parent form after
I have created the child. (I can see all functions, procedures,
visual components, etc) How do I do this?
the child should reference back to the parent. |
for example.
in the OnActivate, OnShow, OnCreate what ever event of the child form
you can simply directly reference the form1 for example.
form1.SomeProperty..
etc..
P.S.
if the child is in a different unit, the put the unit that contains
the parent form in the USES list.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|