Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Question about handling Forms
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00191274
Message ID:
00191283
Views:
21
>I have some forms that I have defined as MODELESS so that other forms may be run. However, I only want the user to be able to run a single instance of a particular form. If the menu selection is made for a form that is already running, I want to change the focus to the existing form instead of creating a new form.

Dave's idea is similar to the solution I've used. When the user selects an option which should either create a form or give it focus, use a function which searches for the form in the _SCREEN.Forms collection. If found, do _SCREEN.Forms[count].Show (though actually ACTIVATE or SHOW WINDOW also still does it, and WEXIST() returns the existence of a form).

>A second problem that I am having is how to I "clean-up" the MODELESS forms when the EXIT is selected from the menu. When I select EXIT, I get the command window (I am not quiting at this point), and the forms are floating around doing "their thing" until they are individually closed.

The simple answer to this is: see Form.Release. My ON SHUTDOWN routine (also called by Exit bar of File menu pad) does:
PROCEDURE AppClose
CLEAR EVENTS
FOR x=1 TO _SCREEN.FormCount	&& This loop could be FOR EACH oFrm in _SCREEN.Forms like David's 
	_SCREEN.Forms[m.x].Release
ENDFOR
DO CloseData	&& Closes tables opened at main.prg start
DO ResetEnvir	&& Resets SET commands for my development preferences
RETURN
Cheers,
Rich.
Rich Addison, Micro Vane, Inc., Kalamazoo, MI
Relax, don't worry, have a homebrew.
- Charlie Papazian, The New Complete Joy of Home Brewing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform