Can't reference on forms properties from another form 
Author Message
 Can't reference on forms properties from another form

Shouldn't I be able to reference and change the properties of one form from
another form?  Example:

Form1 is a customer lookup window

Form2 is a customer data screen

Shouldn't I be able excecute a command like this from form2:

    form1.caption="Don't let the door hit you on the way out"

I've been able to do this with several other forms but I keep getting an
error to the effect of "FORM1 is not an object."   Is this a bug?  Is there
some funky behind the scenes naming convention going on?

Thanks,

Keith



Fri, 01 Mar 2002 03:00:00 GMT  
 Can't reference on forms properties from another form
Nope. Form2 knows nothing about Form1, which is how it should be. Try:

_SCREEN.form1.caption="Don't let the door hit you on the way out"

--

Craig Berntson
Microsoft FoxPro MVP
Salt Lake City Fox User Group
http://members.home.com/foxpro


Quote:
> Shouldn't I be able to reference and change the properties of one form
from
> another form?  Example:

> Form1 is a customer lookup window

> Form2 is a customer data screen

> Shouldn't I be able excecute a command like this from form2:

>     form1.caption="Don't let the door hit you on the way out"

> I've been able to do this with several other forms but I keep getting an
> error to the effect of "FORM1 is not an object."   Is this a bug?  Is
there
> some funky behind the scenes naming convention going on?

> Thanks,

> Keith



Fri, 01 Mar 2002 03:00:00 GMT  
 Can't reference on forms properties from another form
When I try that, I get an error message:

Unknown member FRMCUSTLOOK.

(FRMCUSTLOOK is Form1)

???????



Fri, 01 Mar 2002 03:00:00 GMT  
 Can't reference on forms properties from another form

Quote:

> Shouldn't I be able to reference and change the properties of one form from
> another form?  Example:

> Form1 is a customer lookup window

> Form2 is a customer data screen

> Shouldn't I be able excecute a command like this from form2:

>     form1.caption="Don't let the door hit you on the way out"

You can if both forms are part of a 'formset'. In that case, from form2, write:

thisformset.form1.caption="Don't let the door hit you on the way out"



Fri, 01 Mar 2002 03:00:00 GMT  
 Can't reference on forms properties from another form
Hi Keith,
You are going to have to write a routine that parses the _Screen.forms[]
collection to find "form1" and return an object reference to it.  A lot of
people use the Caption property to base the search on.  You can also use the
Name property.  The code would look something like this:

lparameter lcformname
local loform

for each loform in _Screen.forms
    if loform.Name = lcformname then     && the THEN is optional
        return loform
    endif
endfor

Larry Miller


Quote:
> When I try that, I get an error message:

> Unknown member FRMCUSTLOOK.

> (FRMCUSTLOOK is Form1)

> ???????



Sat, 02 Mar 2002 03:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Changing one form's properties from a different form

2. Top Level Form, Menus and Form's Properties

3. Form array properties: passing by reference

4. Cant Reference other Forms Properties

5. reference form property in a function

6. List boxes in VFP 6.0 - selected property won't set in form's init

7. Referencing properties on non-active form

8. problem using EVAL() with form property referencing

9. referencing properties in a non-active form

10. Q: Cursor's Exclusive property in a form's datasession

11. Referencing form properties

12. Referencing properties from another form

 

 
Powered by phpBB® Forum Software