On 17/04/12 21:19, zeljko wrote:

On Tuesday 17 of April 2012 17:41:54 patspiper wrote:

> This is related to bug #15390:

>

> My understanding is that Showmodal blocks until the form is closed.

> Hiding the form should have no effect.

>

> try

> Self.Hide;

> Form2.ShowModal; //<- this should block until Form2 is closed


So, with your explanation: when you hide modal form it should stay in modal loop and application is completelly unresponsive ?

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).

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:

  try
    Self.Hide; // form1 hides itself
    Form2.ShowModal; // and displays form2
  finally
    Self.Show; // form1 shows itself after form2 is closed
    Form2.Free; // form2 is freed (it was already closed)
  end;


> finally

> Self.Show; // <- this should not be reached until Form2 is closed


no, it will be reached as soon as form leaves *modal loop* for any reason (closing, hiding).

According to Embarcadero: "ShowModal does not return until the form closes"


> Form2.Free;

> end;

>

> What is happening is that Showmodal is exiting when the modal form is

> hidden.


No, FormClose() isn't called when modal form is hidden via Hide();

Correct

, so form still exists and it can be called with ShowModal() or Show() again.

I beg to differ here as Showmodal should not exit unless the modal form is closed.

Stephano
--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to