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

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

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

Post 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...
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

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

Post 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.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

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

Post 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
User avatar
Rathinagiri
Posts: 5482
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

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

Post by Rathinagiri »

Yes. Might be a bug. Let Roberto see this. :)
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
mol
Posts: 3825
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Contact:

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

Post 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.
Attachments
testy_modalwindow.zip
(3.54 KiB) Downloaded 244 times
Post Reply