Addressing non-active form from .prg file 
Author Message
 Addressing non-active form from .prg file

I have a FRMRECORD with a Pageframe with 3 pages

from a .prg file I can address any object with the following

_screen.activeform.pageframe1.page1.object etc

the FRMRECORD has a "Name" of TINVOICE

I need to address the form when its not active

but the following gives me an error saying that member TINVOICE is not found

_screen.tinvoice.pageframe1.page1.object   etc.

I know there must be some way around this

Can any body help

TIA

Joe Kelly



Sat, 15 Sep 2001 03:00:00 GMT  
 Addressing non-active form from .prg file
Try
    tinvoice.pageframe1.page1.object   etc.

Ron

Quote:

>I have a FRMRECORD with a Pageframe with 3 pages

>from a .prg file I can address any object with the following

>_screen.activeform.pageframe1.page1.object etc

>the FRMRECORD has a "Name" of TINVOICE

>I need to address the form when its not active

>but the following gives me an error saying that member TINVOICE is not
found

>_screen.tinvoice.pageframe1.page1.object   etc.

>I know there must be some way around this

>Can any body help

>TIA

>Joe Kelly



Sat, 15 Sep 2001 03:00:00 GMT  
 Addressing non-active form from .prg file

Quote:

> Try
>     tinvoice.pageframe1.page1.object   etc.


>>I have a FRMRECORD with a Pageframe with 3 pages

>>from a .prg file I can address any object with the following
>>_screen.activeform.pageframe1.page1.object etc

>>the FRMRECORD has a "Name" of TINVOICE

>>I need to address the form when its not active

>>but the following gives me an error saying that member
>>TINVOICE is not found

>>_screen.tinvoice.pageframe1.page1.object   etc.

>>I know there must be some way around this

Joe --

A form can be addressed in several ways:
-Via a variable reference to the form object, if one exists, e.g.
m.oForm.show()
-Via the name property, if the form is a member of a formset and there's
a variable reference to the formset, e.g. m.oFormset.form1.show()
-If the form is the active form, via _SCREEN.activeForm
-Via the _SCREEN.forms array. When all else fails, this can access all
active or inactive forms.

If there are any other ways, I know the good members of this NG will let
us know about them posthaste.

Note that the name property of an object (including form objects) is
useless unless the object is contained by a parent object (in the case
of a form, a formset). There's a lot of confusion about this, I think
because _SCREEN sort of acts like a parent container and sort of
doesn't. Specifically, it has collection properties (.forms, .formCount)
like those used by containers to access their member objects, but it
doesn't behave like a container in any other way (e.g. setAll() doesn't
work).

Joe, in your case you probably need to do something like this:
*************************************
LOCAL i
FOR i = 1 TO _SCREEN.formCount
        IF UPPER(_SCREEN.forms[i].name)=="TINVOICE"
                invForm = _SCREEN.forms[i]
                EXIT
        ENDIF
ENDFOR
invForm.pageframe1.page1.object.aMethod()
**************************************

I hope this helps,
- Neil



Sat, 15 Sep 2001 03:00:00 GMT  
 Addressing non-active form from .prg file
Thanks Neil & Ronald,

Your replies have solved my problem and given me a better understanding of
what's going on.

Joe



Sat, 15 Sep 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Referencing properties on non-active form

2. referencing properties in a non-active form

3. Form hierarchy non-Modal, but non-Modeless ? :-(

4. Q: Form hierarchy non-Modal, but non-Modeless ? :-(

5. HOW TO EXPORT LIST OF ALL SMTP ADDRESSES WITHIN EXCHANGE 2000 / ACTIVE DIRECTORY

6. USing a FORM within a PRG file

7. do forms and menus slow down *.prg files?

8. Using a member of a form in a prg file

9. Prg file in Form.init

10. calling a form in a prg file

11. Help: Form.Refresh() doesn't work for active form if mutiple forms on screen

12. addressing form from menu on top level form ?

 

 
Powered by phpBB® Forum Software