Event Handler Problem

  • Thread starter Thread starter Bob Clegg
  • Start date Start date
B

Bob Clegg

Hi,
I have a form (Mapmaster) that has an arbitary number of thumbnails that
represent maps on it.
When the user clicks a thumbnail it causes an instance of another form (Map)
to open displaying the map that the thumbnail represents.

My problem is that I also allow the user to add / delete thumbnails. When
deleting I can check that a map is open by keeping a list of clicked
thumbnails and advise the user to close the associated map form before
trying to delete its thumbnail.
But I am having difficulty seeing how to check that the map has been closed.
If it was a small fixed number of maps then I would declare private
withevents map variables to open the Map forms and handle a custom
'Mapclosing' event of these variables.
This approach is not practical with an arbitary number of thumbnails.
So my problem is how can the Mapmaster form detect that the user has closed
a map form and identify which map has been closed. From there I can update
the Mapmaster open list and allow deletion of the 'closed' thumbnail on
Mapmaster.
Thanks
Bob
 
Hi Bob,

This list of maps that are open - where is it? I'm guessing that currently
it's the Mapmaster form that is doing the list management. You could move that
into a MapFormsList module/class. If you keep it in a Module or as a singleton
class (depending on your style), your map forms can be responsible for
themselves and simply notify the MapFormsList when they open and close. Direct
calls to the MapFormsList wouldn't require any events.

Regards,
Fergus
 
Back
Top