<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
On 17/04/12 21:19, zeljko wrote:
<blockquote cite="mid:201204172019.13382.zeljko@holobit.net"
type="cite">
<meta name="qrichtext" content="1">
<style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;">On Tuesday 17 of April
2012 17:41:54 patspiper wrote:</p>
<p style="margin: 0px; text-indent: 0px;">> This is related to
bug #15390:</p>
<p style="margin: 0px; text-indent: 0px;">> </p>
<p style="margin: 0px; text-indent: 0px;">> My understanding is
that Showmodal blocks until the form is closed.</p>
<p style="margin: 0px; text-indent: 0px;">> Hiding the form
should have no effect.</p>
<p style="margin: 0px; text-indent: 0px;">> </p>
<p style="margin: 0px; text-indent: 0px;">> try</p>
<p style="margin: 0px; text-indent: 0px;">> Self.Hide;</p>
<p style="margin: 0px; text-indent: 0px;">> Form2.ShowModal;
//<- this should block until Form2 is closed</p>
<p style="margin: 0px; text-indent: 0px;"><br>
</p>
<p style="margin: 0px; text-indent: 0px;">So, with your
explanation: when you hide modal form it should stay in modal
loop and application is completelly unresponsive ?</p>
</blockquote>
Yes. The same situation occurs when a form in a single form project
hides itself. The application will be running, but no form is
displayed and the application is completely unresponsive (I have
just checked that in Lazarus).<br>
<br>
It is up to the programmer to make use of that fact. For example, a
modal form can hide itself to show another modal form:<br>
<br>
try<br>
Self.Hide; // form1 hides itself<br>
Form2.ShowModal; // and displays form2<br>
finally<br>
Self.Show; // form1 shows itself after form2 is closed<br>
Form2.Free; // form2 is freed (it was already closed)<br>
end;<br>
<blockquote cite="mid:201204172019.13382.zeljko@holobit.net"
type="cite">
<p style="margin: 0px; text-indent: 0px;"><br>
</p>
<p style="margin: 0px; text-indent: 0px;">> finally</p>
<p style="margin: 0px; text-indent: 0px;">> Self.Show; // <-
this should not be reached until Form2 is closed</p>
<p style="margin: 0px; text-indent: 0px;"><br>
</p>
<p style="margin: 0px; text-indent: 0px;">no, it will be reached
as soon as form leaves *modal loop* for any reason (closing,
hiding).</p>
</blockquote>
According to Embarcadero: "ShowModal does not return until the form
closes"<br>
<blockquote cite="mid:201204172019.13382.zeljko@holobit.net"
type="cite">
<p style="margin: 0px; text-indent: 0px;"><br>
</p>
<p style="margin: 0px; text-indent: 0px;">> Form2.Free;</p>
<p style="margin: 0px; text-indent: 0px;">> end;</p>
<p style="margin: 0px; text-indent: 0px;">> </p>
<p style="margin: 0px; text-indent: 0px;">> What is happening
is that Showmodal is exiting when the modal form is</p>
<p style="margin: 0px; text-indent: 0px;">> hidden.</p>
<p style="margin: 0px; text-indent: 0px;"><br>
</p>
<p style="margin: 0px; text-indent: 0px;">No, FormClose() isn't
called when modal form is hidden via Hide();</p>
</blockquote>
Correct<br>
<blockquote cite="mid:201204172019.13382.zeljko@holobit.net"
type="cite">
<p style="margin: 0px; text-indent: 0px;"> , so form still exists
and it can be called with ShowModal() or Show() again.</p>
</blockquote>
I beg to differ here as Showmodal should not exit unless the modal
form is closed.<br>
<br>
Stephano<br>
</body>
</html>