Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 5 Monaten, 3 Wochen
Letzter Beitrag:
vor 5 Monaten, 3 Wochen
Beteiligte Autoren:
Andrew Strubhar, Fabrice Harari

[WM20+WM21] Children of a parent window won't close as expected

Startbeitrag von Andrew Strubhar am 22.02.2017 15:19

I'm having another problem with Close() in WM20 and WM21.

My app starts with a single window (WIN_First). When the user clicks something, it then opens the next window (WIN_Second). Once the user gets to the last window (WIN_Fourth), I want to close all the windows except the first (WIN_First).

Right now, when a user clicks an action on WIN_Fourth, I'm calling the code "Close(WIN_Second)". The WinDev documentation seems to suggest this should close WIN_Second, WIN_Third, and WIN_Fourth. What actually happens is only WIN_Fourth is closed (and the user can see WIN_Third).

- Does my approach to window management in WM make sense?

- Has anyone ever encountered this problem?

Thank you!

[attachment 2285 WindowExample.png]


Hi Andrew,

I call what you are doing "sawing the branch you are sitting on".

Basically, you are messing with the internal stack, where all calls are stored.0

For this kind of needs, I always use one main window (can be invisible), in charge of opening and closing all the others. When any windows wants to claose or open any window, it just asks the main one to do it.

This way, everything works fine, all the time.

Or, in a mobile environment, you could use planes instead of separate windows.

Best regards

von Fabrice Harari - am 22.02.2017 15:39
Fabrice Harari
I call what you are doing "sawing the branch you are sitting on".

Great analogy! It seems like this was exactly my problem.

I came up with a slightly different solution that you suggested. I placed code inside the "Closing of a Child Window" so that I wouldn't accidently terminate the process by closing my stack. Visually this looks like this:

[attachment 2288 WindowExample.png]

von Andrew Strubhar - am 22.02.2017 17:33
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.