I have an MDI application. I guarantee that each MDIChild window can only have one copy open at a time. Within the code of the window, I need to do things or check things related to that window. For example, I need to check if the window is visible.
I would normally do this with...
if MyForm.Visible = true ...
Then question is: Is there an easy way to get 'MyForm'.
MyForm is a variable of type TMyForm. I know that when I look at the source code for the window, I have a variable declaration of
MyForm : TMyForm;
but this is not set to anything. I need to set it to a valid value. I can do this with this code...
// Create a handle to the Current Window
ThisWindow := nil;
with Application.MainForm do
for N := 0 to MDIChildCount - 1 do
if MDIChildren[N] is TMyForm then
ThisWindow := MDIChildren[N] as TMyFormF;
Isn't there an easier way to do this?
Please respond to email@example.com