<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 12 mag 2022 alle ore 12:03 Bruce Steers <<a href="mailto:bsteers4@gmail.com">bsteers4@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 12 May 2022 at 10:49, Gianluigi <<a href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 12 mag 2022 alle ore 11:41 Bruce Steers <<a href="mailto:bsteers4@gmail.com" target="_blank">bsteers4@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><div style="font-size:small"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 12 May 2022 at 10:34, Gianluigi <<a href="mailto:bagonergi@gmail.com" target="_blank">bagonergi@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 12 mag 2022 alle ore 11:13 Bruce Steers <<a href="mailto:bsteers4@gmail.com" target="_blank">bsteers4@gmail.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-size:small">Note. using the Windows array and .Close as I suggested exits cleanly with no warnings at all.<br></div><div style="font-size:small"><br></div><div style="font-size:small">Just setting Application.MainWindow = Me like Ben says does close all windows but I get all this on exit...</div><div style="font-size:small"><br></div><div style="font-size:small">(_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_reset: assertion 'GTK_IS_IM_CONTEXT (context)' failed<br>(_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_set_client_window: assertion 'GTK_IS_IM_CONTEXT (context)' failed<br>(_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_reset: assertion 'GTK_IS_IM_CONTEXT (context)' failed<br>(_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_focus_out: assertion 'GTK_IS_IM_CONTEXT (context)' failed<br>(_aa:72471): Gtk-CRITICAL **: 10:06:51.207: gtk_im_context_reset: assertion 'GTK_IS_IM_CONTEXT (context)' failed<br></div><div style="font-size:small"><br></div><div style="font-size:small">gbx3 [72471]: warning: circular references detected:<br>gbx3: Â Â 1 Form1<br>gbx3: Â Â 1 Spring<br>gbx3 [72471]: warning: 17 allocation(s) non freed.</div></div></blockquote><div><br></div><div>If one uses a loop to close all windows what good is Application.MainWindow = Me?<br>Application.MainWindow = Me is only needed if you close 'the window' (one of the windows in charge of closing the application) that correctly closes the application.<br><br>To recap if I have only one Main window then on opening I will indicate the main as Application.MainWindow, otherwise, if the windows assigned to that task are more than one, my suggestion may be useful.<br></div></div></div></blockquote><div><br></div><div style="font-size:small">All suggestions for improvement are always welcome :)<br></div><div style="font-size:small"><br></div><div style="font-size:small">I'm just saying the Application.MainWindow method sounded much better than using a loop as i suggested but unfortunately it does not seem to be as clean.</div><div style="font-size:small"></div><div style="font-size:small">BruceS<br></div></div></div>
<br>
----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br></blockquote><div><br></div><div>I probably misunderstood.<br>You should attach an example</div></div></div></blockquote><div><br></div><div style="font-size:small">I just modified a test app that makes an additional form with the loop to test my initial solution.</div><div style="font-size:small">Like i say using the Windows[] array exits clean, using Application.MainWindow method does not</div><div style="font-size:small">Â (just uncomment the MainWindow allocation and comment the loop in Form_Close)</div><div style="font-size:small"><br></div><div style="font-size:small">Is it a bug in Application.MainWindow method Ben?</div><div style="font-size:small"><br></div><div style="font-size:small">BruceS</div><div style="font-size:small"><br></div></div></div>
<br>
----[ <a href="http://gambaswiki.org/wiki/doc/netiquette" rel="noreferrer" target="_blank">http://gambaswiki.org/wiki/doc/netiquette</a> ]----<br></blockquote><div><br></div><div>Sorry but your code is not clear to me, try this:<br>[code]<br>Public Sub Form_Open()<br><br>Â Dim hWindow As Window<br><br>Â Application.MainWindow = Me<br>Â With Me<br>Â Â .Width = 420<br>Â Â .Height = 420<br>Â Â .Center<br>Â Â .Title = "MAIN WINDOW"<br>Â End With<br>Â For i As Integer = 0 To 9<br>Â Â With hWindow = New Window As "Form" & CStr(i + 1)<br>Â Â Â .X = i * 50<br>Â Â Â .Y = i * 50<br>Â Â Â .Width = 420<br>Â Â Â .Height = 420<br>Â Â Â .Title = "FORM " & CStr(i + 1)<br>Â Â Â .Show<br>Â Â End With<br>Â Next<br><br>End<br>[/code]<br><br>Regards<br>Gianluigi</div></div></div>