Page 1 of 1

How to get the name od index of top modal window???

Posted: Thu Jul 22, 2010 9:01 am
by mol
I'm working with huge project and I got an error:

Code: Select all

Non top modal windos can't be released
When I display value of _HMG_SYSDATA[66] ( which contains name of windows... I think :) ) I can see empty positions:

Code: Select all

_HMG_SYSDATA[66] : {"OknoGlowne", "OknoIndeksowanie", "_HMG_CHILDWAITWINDOW", "OknoWplaty", "OknoRejestrFaktur", "", "", ""}
What's going on?
I'm releasing all modal windows created by me...

Re: How to get the name od index of top modal window???

Posted: Thu Jul 22, 2010 9:48 am
by Rathinagiri
This shows that, the program control is in an infinite loop.

See this situation:

You call a modal window in the "on gotfocus" event of a control.

Once you are releasing the modal window just created, the previous control gets focus again. In this situation, the window focused is not the modal window. But the parent window. So you can't release a non-top modal window. Further, the focused control calls the event again and again in a loop.

Therefore, we have to avoid creating modal windows from "on gotfocus" events. Please check for this in your code.

Re: How to get the name od index of top modal window???

Posted: Thu Jul 22, 2010 11:34 am
by mol
I don't create windows on got focus. I think it's a problem within HMG. Why names of forms in _HMG_SYSDATA[66] are null strings and _HMG_SYSDATA[69] which containts type idetifiers of defined windows, too:

Code: Select all

_HMG_SYSDATA[66] -> {"OknoGlowne", "OknoIndeksowanie", "_HMG_CHILDWAITWINDOW", "OknoWplaty", "OknoRejestrFaktur", "", "", "", "", "", ""}
_HMG_SYSDATA[69] -> {"A", "C", "C", "M", "M", "", "", "", "", "", ""}
I Think, This table should be truncated after releasing form. I think, Roberto could help us to understand this problem.
Best regards, Marek

Re: How to get the name od index of top modal window???

Posted: Thu Jul 22, 2010 12:54 pm
by Rathinagiri
Yes. Might be a bug. Let Roberto see this. :)

Re: How to get the name od index of top modal window???

Posted: Fri Jul 23, 2010 9:34 am
by mol
After two days of searching and studying HMG sources and my project souces, I found that my problems were caused by .Restore method...
I wrote something like that:

Code: Select all

OknoFaktura.Restore
OknoFaktura.Release
this phrase was written about 2 years ago and till now didn't cause any crash of application.
But, now, in different circumstances this phrase causes that while releasing OknoRejestrFaktur, which was parent to OknoFaktura error about non top modal windows occurs.

Maybe something is wrong with .RESTORE method ?
I don't know, I have no time and knowledge about HMG to search it.
Maybe Roberto will give an answer to me when he will be back.

Best regards, Marek

PS. I've created a small project to test it, but, no crashes was observed :D
I'm attaching this. Maybe it will be useful for sb.