Page 1 of 1
How to know number of windows opened
Posted: Tue Dec 22, 2009 4:05 pm
by sudip
Hello All,
Is there any way to know the number of windows opened?
Thanks in advance.
With best regards.
Sudip
Re: How to know number of windows opened
Posted: Tue Dec 22, 2009 6:11 pm
by Rathinagiri
On seeing h_init.prg line no. 131 there is a system variable for all the form types defined by a HMG application.
Code: Select all
_HMG_SYSDATA [ 69 ] -> _HMG_aFormType
The length of this _HMG_SYSDATA[69] will be equal to the total number of forms defined at any time.
So, you can use len(_HMG_SYSDATA[69]) to find out the number of forms.
Split child windows are also taken into account as forms. This array can have values "A","C","S","M","X"
"A" means Main Window
"C" means Child Window
"X" means Splitchild Window
"M" means Modal window
"S" means Standard window
If you want the number of main, modal and child windows use this loop.
Code: Select all
nCount := 0
for i := 1 to len(_HMG_SYSDATA[69])
if (_HMG_SYSDATA[69,i] == "A" .or. _HMG_SYSDATA[69,i] == "M" .or. _HMG_SYSDATA[69,i] == "C")
nCount++
endif
next i
msginfo("There are "+str(nCount)+" windows defined")
Re: How to know number of windows opened
Posted: Wed Dec 23, 2009 4:53 am
by sudip
Thanks a lot Rathi,
Great!!!
I want it to ensure that when user will try to change Accounting Year online, no other window (except main window) will be opened

Your code will be extremely helpful to me

With best regards.
Sudip
Re: How to know number of windows opened
Posted: Thu Dec 24, 2009 3:04 pm
by luisvasquezcl
Hi Rathi
very interesting and instructive your comment, thanks
Best regards,
Luis Vasquez.
Re: How to know number of windows opened
Posted: Fri Dec 25, 2009 5:44 am
by Alex Gustow
Hi Rathi! Great! Thanks!