>thanks Paul for your answer - could
>you give me an example of how to use _screen.forms()?
Suppose you are in an Invoice Entry form. And you want to change the
customer information, but the Customer Information form can only be open
once. In this case you would want to use the current Customer
Information for if it was open and, if it wasn't, open it.
You could:
* Determine if the Customer form is already open,.
* and put the array number into m.lnCustomerForm
m.lnCustomerForm = 0
for m.lnCount = 1 to _screen.FormCount
if _screen.forms(m.lnCount).Caption = "Customer Information"
m.lnCustomerForm = m.lnCount
endif
endfor
* Activate the Customer Form
if m.lnCustomerForm # 0
_screen.forms(m.lnCustomerForm).Activate
else
do form frmCustomerInformation
endif
Or suppose you wanted to cascade all of the forms. Here's the code that
I use:
*****
* Determine how many characters to move the Windows
* This is the Standard Windows Border + the Size of the Close box.
*****
m.lpOffset = sysmetric(3)+sysmetric(5)
m.lpFormNumber = 0
m.lpFormLevel = 10
*****
* Work with each valid form in turn
* 1) The form must exist
* 2) It must be a Form (not a Toolbar)
* 3) The form must be Visible and Active
* 4) The form must have a Border
*****
for m.lpCount = _screen.FormCount to 1 step -1
if type("_screen.forms(m.lpCount)") = "O" and ;
(not IsNull(_screen.forms(m.lpCount))) and ;
_screen.forms(m.lpCount).BaseClass = "Form" and ;
_screen.forms(m.lpCount).Visible and ;
_screen.forms(m.lpCount).Enabled and ;
_screen.forms(m.lpCount).BorderStyle # 0
*****
* Move the Form
*****
_screen.forms(m.lpCount).Top = m.lpFormNumber * m.lpOffset
_screen.forms(m.lpCount).Left = m.lpFormNumber * m.lpOffset
*****
* Update the number of Forms that have been moved
*****
if m.lpFormNumber = m.lpFormLevel
m.lpFormNumber = 0
else
m.lpFormNumber = m.lpFormNumber + 1
endif
endif
endfor