Board index » cppbuilder » How detect child form minimized - WindowState broken?

How detect child form minimized - WindowState broken?

How can I detect when a child form is minimized or restored?

With Builder 3.0, I could have code for the FormResize event that
looked at the form WindowState. When I minimize a child form,
the WindowState is wsMinimized, and when I restore the form,
the WindowState is wsNormal, as I expected.

However, my code doesn't seem to work with Builder 4. I tried a
simple experiment with the following code in a child form:

//---------------------------------------------------------------------------
void __fastcall TFormChild::FormResize(TObject *Sender)
{
 if (WindowState == wsNormal)
   ShowMessage("in FormResize Child WindowState == wsNormal");
 else if (WindowState == wsMinimized)
   ShowMessage("in FormResize Child WindowState == wsMinimized");
 else if (WindowState == wsMaximized)
   ShowMessage("in FormResize Child WindowState == wsMaximized");

Quote
}

From this, it appears that the WindwState is now set AFTER the
FormResize
routine is called. For example:

- When the program starts, I get WindowState == wsNormal.
- When I minimize the child form, I get WindowState == wsNormal.
- When I then resore the child form, I get WindowState == wsMinimized.
- If I then maximixe the child form, I get WindowState == wsNormal.
- If I then restore the child form, I get WindowState == wsMaximized.

When I rebuild the identical code with Builder 3, I get what I expect,
i.e.
- When the program starts, I get WindowState == wsNormal.
- When I minimize the child form, I get WindowState == wsMinimized.
- When I then resore the child form, I get WindowState == wsNormal.
- If I then maximixe the child form, I get WindowState == wsMaximized.
- If I then restore the child form, I get WindowState == wsNormal.

Has anyone else seen this?

Is this a defect or a feature?

Does anybody have suggestions for a workaround?

Thanks.
Jock Embry, Opening Technologies

 

Re:How detect child form minimized - WindowState broken?


Quote
Jock Embry wrote in message <380DAFF9.5C5A2...@opent.com>...
>How can I detect when a child form is minimized or restored?

You might want to try hooking the windows messages directly.

As for your code, I suggest that you submit a bug report on it.

Harold Howe [TeamB]
http://www.bcbdev.com

Other Threads