BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using variables from other forms

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc
View previous topic :: View next topic  
Author Message
Nick Alexander
Guest





PostPosted: Tue Jan 11, 2005 8:33 pm    Post subject: Using variables from other forms Reply with 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?
Back to top
Tom de Neef
Guest





PostPosted: Tue Jan 11, 2005 10:19 pm    Post subject: Re: Using variables from other forms Reply with quote



"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





PostPosted: Thu Jan 13, 2005 8:17 pm    Post subject: Re: Using variables from other forms Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.misc All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.