Board index » cppbuilder » How Getting all Forms

How Getting all Forms


2004-05-30 02:19:00 AM
cppbuilder5
I have create multiple NON modal Form in my application .
What is the way for getting an array of all Form pointers ?
I have used this code :
for (int i = 0; i < Application->ComponentCount; i++)
{
if (Application->Components[i])->InheritsFrom((__classid(TForm))))
ShowMessage("<" + IntToStr(i) + ">\n" +
Application->Components[i]->Name);
}
but it doesn't list all non modal Forms.
What is wrong ?
Sam
 
 

Re:How Getting all Forms

Use the global Screen variable:
AnsiString S = "Forms:\n";
for( int i=0; i < Screen->FormCount; ++i )
{
S += Screen->Forms[i]->Name + '\n';
}
ShowMessage( S );
Todd
"Sam" < XXXX@XXXXX.COM >wrote in message news: XXXX@XXXXX.COM ...
Quote
I have create multiple NON modal Form in my application .

What is the way for getting an array of all Form pointers ?
I have used this code :
for (int i = 0; i < Application->ComponentCount; i++)
{
if (Application->Components[i])->InheritsFrom((__classid(TForm))))
ShowMessage("<" + IntToStr(i) + ">\n" +
Application->Components[i]->Name);
}

but it doesn't list all non modal Forms.
 

Re:How Getting all Forms

Thank you Todd.
"Todd Brylski" < XXXX@XXXXX.COM >a écrit dans le message de
Quote
Use the global Screen variable:

AnsiString S = "Forms:\n";
for( int i=0; i < Screen->FormCount; ++i )
{
S += Screen->Forms[i]->Name + '\n';
}
ShowMessage( S );

Todd

"Sam" < XXXX@XXXXX.COM >wrote in message
>I have create multiple NON modal Form in my application .
>
>What is the way for getting an array of all Form pointers ?
>I have used this code :
>for (int i = 0; i < Application->ComponentCount; i++)
>{
>if (Application->Components[i])->InheritsFrom((__classid(TForm))))
>ShowMessage("<" + IntToStr(i) + ">\n" +
>Application->Components[i]->Name);
>}
>
>but it doesn't list all non modal Forms.


 

{smallsort}