Referencing properties from another form 
Author Message
 Referencing properties from another form

I have a login form that stores user information ( name, default data
directory, etc. ) into some custom properties.  After launching other forms
I need to reference these property values, but they don't seem
referenceable, although the property is marked global.  The name of my form
is frmLogin and a property is cUserID.  Am I asking for the info correctly
in the second form by saying :

If frmLogin.cUserID = "XXX"   ( This does not work )

Thanks.



Fri, 10 May 2002 03:00:00 GMT  
 Referencing properties from another form
You can instantiate the form by using DO FORM  WITH the LINK option (See
help file for further info about the synthax).

If you use f.i. LINK MyForm you can reference to MyForm.cProperty

Ed Veld



Quote:
> I have a login form that stores user information ( name, default data
> directory, etc. ) into some custom properties.  After launching other
forms
> I need to reference these property values, but they don't seem
> referenceable, although the property is marked global.  The name of my
form
> is frmLogin and a property is cUserID.  Am I asking for the info correctly
> in the second form by saying :

> If frmLogin.cUserID = "XXX"   ( This does not work )

> Thanks.



Fri, 10 May 2002 03:00:00 GMT  
 Referencing properties from another form
Teddy,

One way could be using the NAME clause of the DO FORM command.
If you'd define something like goFrmLogin as a property of a global
appliction object or a public var and call your form "do form login name
goFrmLogin",
you could reference goFrmLogin.cUserID from your entire app.

hth
Stefan



Quote:
> I have a login form that stores user information ( name, default data
> directory, etc. ) into some custom properties.  After launching other forms
> I need to reference these property values, but they don't seem
> referenceable, although the property is marked global.  The name of my form
> is frmLogin and a property is cUserID.  Am I asking for the info correctly
> in the second form by saying :

> If frmLogin.cUserID = "XXX"   ( This does not work )

> Thanks.



Fri, 10 May 2002 03:00:00 GMT  
 Referencing properties from another form
Well lets combine the two answers:

If you use NAME in the DO FORM you give the form a name to reference it by,
but that doesn't work if the form is out of scope.

USE DO FORM form1 NAME MyForm LINK oForm

Now you can reference to the form as a variable oForm. So a refernece to a
method would be something like oForm.Resize().

Within the form you can reference anything like
MyForm.cntContainer1.txtTextBox1.value or something like that.

Ed Veld



Quote:
> I have a login form that stores user information ( name, default data
> directory, etc. ) into some custom properties.  After launching other
forms
> I need to reference these property values, but they don't seem
> referenceable, although the property is marked global.  The name of my
form
> is frmLogin and a property is cUserID.  Am I asking for the info correctly
> in the second form by saying :

> If frmLogin.cUserID = "XXX"   ( This does not work )

> Thanks.



Fri, 10 May 2002 03:00:00 GMT  
 Referencing properties from another form
Hi Edward,

I'm afraid you're wrong in this case.

Edward Veld schrieb in Nachricht

Quote:
>Well lets combine the two answers:

>If you use NAME in the DO FORM you give the form a name to reference it
by,
>but that doesn't work if the form is out of scope.

The NAME clause won't affect Form.Name but it creates a name variable (a
form's object reference) and it does work as long as the _name var_ doesn't
go out of scope.
That's why it must have a global quality.

The optional LINKED is a nice thing but it's only for releasing the form
automatically, if the name var is released (or set to .NULL. or is going
out of scope).

You may want to test it:
public goTest
do form test name goTest
*After this you can reference goTest (even if the form is deactivated or
hidden)
*If you would release goTest now (or if it's going out of scope by
accident), the form still exists but the reference is gone.
*If you add LINKED to the end of the above, the form will be released by
storing .NULL. to goTest or releasing the var.

Quote:
>USE DO FORM form1 NAME MyForm LINK oForm

This would lead to an error message because LINKED can't introduce it's own
name variable.

Using the LINKED clause without an explicit NAME implies the forms .scx
file name as NAME:
"do form test linked" is the same as "do form test name test linked".

Regards,
Stefan

<snipped>



Sat, 11 May 2002 03:00:00 GMT  
 Referencing properties from another form
Yes, I am. Sorry...it has been a long while since I really used a form
working in a CodeBook environment....looks stupid doesn't it, but you're
absolutely right.

Ed...;-(



Quote:
> Hi Edward,

> I'm afraid you're wrong in this case.

> Edward Veld schrieb in Nachricht

> >Well lets combine the two answers:

> >If you use NAME in the DO FORM you give the form a name to reference it
> by,
> >but that doesn't work if the form is out of scope.

> The NAME clause won't affect Form.Name but it creates a name variable (a
> form's object reference) and it does work as long as the _name var_
doesn't
> go out of scope.
> That's why it must have a global quality.

> The optional LINKED is a nice thing but it's only for releasing the form
> automatically, if the name var is released (or set to .NULL. or is going
> out of scope).

> You may want to test it:
> public goTest
> do form test name goTest
> *After this you can reference goTest (even if the form is deactivated or
> hidden)
> *If you would release goTest now (or if it's going out of scope by
> accident), the form still exists but the reference is gone.
> *If you add LINKED to the end of the above, the form will be released by
> storing .NULL. to goTest or releasing the var.

> >USE DO FORM form1 NAME MyForm LINK oForm

> This would lead to an error message because LINKED can't introduce it's
own
> name variable.

> Using the LINKED clause without an explicit NAME implies the forms .scx
> file name as NAME:
> "do form test linked" is the same as "do form test name test linked".

> Regards,
> Stefan

> <snipped>



Sat, 11 May 2002 03:00:00 GMT  
 Referencing properties from another form
Edward,

It was a technical discussion only, wasn't it? I'm glad you can't see
my daily "stupid" things :-)

-Stefan



Quote:
> Yes, I am. Sorry...it has been a long while since I really used a
form
> working in a CodeBook environment....looks stupid doesn't it, but
you're
> absolutely right.

> Ed...;-(


berichtnieuws

> > Hi Edward,

> > I'm afraid you're wrong in this case.

> > Edward Veld schrieb in Nachricht

> > >Well lets combine the two answers:

> > >If you use NAME in the DO FORM you give the form a name to
reference it
> > by,
> > >but that doesn't work if the form is out of scope.

> > The NAME clause won't affect Form.Name but it creates a name
variable (a
> > form's object reference) and it does work as long as the _name
var_
> doesn't
> > go out of scope.
> > That's why it must have a global quality.

> > The optional LINKED is a nice thing but it's only for releasing
the form
> > automatically, if the name var is released (or set to .NULL. or is
going
> > out of scope).

> > You may want to test it:
> > public goTest
> > do form test name goTest
> > *After this you can reference goTest (even if the form is
deactivated or
> > hidden)
> > *If you would release goTest now (or if it's going out of scope by
> > accident), the form still exists but the reference is gone.
> > *If you add LINKED to the end of the above, the form will be
released by
> > storing .NULL. to goTest or releasing the var.

> > >USE DO FORM form1 NAME MyForm LINK oForm

> > This would lead to an error message because LINKED can't introduce
it's
> own
> > name variable.

> > Using the LINKED clause without an explicit NAME implies the forms
.scx
> > file name as NAME:
> > "do form test linked" is the same as "do form test name test
linked".

> > Regards,
> > Stefan

> > <snipped>



Sun, 12 May 2002 03:00:00 GMT  
 Referencing properties from another form
perhaps the two forms need to be in the same formset?

Also, how does the login form authenticate a user?  If it's reading a
table, couldn't the application look at where the authentication routine
left the record pointer in the user table?  I guess the process used
depends on how secure you want the application.

(You could also assign the data to global variables defined in the Main
program)



Sun, 12 May 2002 03:00:00 GMT  
 Referencing properties from another form
Hi Teddy,

If your form object
...really exists (for example, hiden),
...and It(form) has public properties
...and the it(form) unique caption (or something as public) of the window is
known for you...
you always can receive access to it properties through the reference
_SCREEN.Forms ()
key for search in a collection you can use a property _SCREEN.Forms
(i).Caption (see also
_SCREEN.FormCount Property)

However, it is better to have similar properties in instance of a class of
Application (through a global variable goApp) or immediately as properties
of Application or through a method of class Application...

Best regards,
Michael, Russia
___________________________________________________________________________

ICS page: http://www.ics.perm.ru/ [on Russian]
My page: http://skyscraper.fortunecity.com/zeros/287/
__________________________________________________________________________

Quote:
> I have a login form that stores user information ( name, default data
> directory, etc. ) into some custom properties.  After launching other
forms
> I need to reference these property values, but they don't seem
> referenceable, although the property is marked global.  The name of my
form
> is frmLogin and a property is cUserID.  Am I asking for the info correctly
> in the second form by saying :

> If frmLogin.cUserID = "XXX"   ( This does not work )

> Thanks.



Mon, 20 May 2002 03:00:00 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. Can't reference on forms properties from another form

2. Form array properties: passing by reference

3. Cant Reference other Forms Properties

4. reference form property in a function

5. Referencing properties on non-active form

6. problem using EVAL() with form property referencing

7. referencing properties in a non-active form

8. Referencing form properties

9. ?? Pass property by reference

10. Help with ActiveX control property references

11. Expert help requested -passing class properties to UDFs by reference

12. Referencing Class Properties

 

 
Powered by phpBB® Forum Software