 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
odonata Guest
|
Posted: Tue Apr 04, 2006 4:03 pm Post subject: Iterating through SDI open forms |
|
|
I have an SDI program with about a dozen forms that is used in
a multi-monitor environment. This application has a Data Module
with a callback function that is fired by events on a remote
server. When a specific event occurs on the server, the program
immediately knows what type of event has occurred (without
having to constantly poll the server).
Depending on the type of server event, I want to execute
specific code on the appropriate open forms. This usually
involves the refreshing, addition or deletion of data from
a list (grid). This program has several users monitoring the
same set of resources (equipment). If one user changes the
status of a resource, I want the other users to instantly
see that change in their form list without having to manually
click a button or use a timer to refresh their view.
If "Event A" occurs, I want every user who has one or more
"Form A" opened to have the list on that form refreshed.
The problem that I've run into is finding an elegant way to
iterate through all the open forms in an SDI application. I
don't know if a user will have a particular form opened or
if they will have several copies of the same form opened.
Forms can be used to give a filtered view of the data so
the users will occasionally have several of the same type
form opened each one monitoring a specific type of equipment.
If I can find the code to iterate through the open forms, then
I know how to cast the form to the appropriate type so I can
invoke the routine I need to on that form. I have done this
by casting the ActiveMDIChild in an MDI program before. But
this program must be SDI and not every form is a child of
the main form.
I know in the Microsoft world, iterating through the forms
collection is fairly trivial but I have been unable to Google
a similar solution in C++ Builder 6.0. Before I attempted to
roll my own solution, I thought I would try to find out if
there were any gurus out there that had already tackled
this problem.
I had found a commercial product that may be useful, but for
my own knowledge, I'd like to find out if there is a solution
I can code myself. To see that product, go to the following
hyperlink: http://syntetix.com/products/syntfm/
Thanks for any help or suggestions.
~O |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Apr 04, 2006 4:03 pm Post subject: Re: Iterating through SDI open forms |
|
|
odonata wrote:
| Quote: | The problem that I've run into is finding an elegant way to
iterate through all the open forms in an SDI application.
|
Use the global TScreen instance.
AnsiString Info;
int nr = -1;
while ( ++nr < Screen->FormCount )
{
Info += Screen->Forms[nr]->Caption + "\n";
}
ShowMessage ( Info );
Hans. |
|
| Back to top |
|
 |
odonata Guest
|
Posted: Tue Apr 04, 2006 5:03 pm Post subject: Re: Iterating through SDI open forms |
|
|
Thanks Hans.
This is exactly what I needed.
A lot more concise than the possible "solutions" I was
designing in my head.
~O |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|