Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Preventing to open a form twice or more ...
Message
 
 
To
31/08/2000 10:56:42
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00411292
Message ID:
00411308
Views:
26
>Any great idea how would i prevent to open a form more than once...

I have an application object, goApp, that has a DoForm method. In my apps I almost always start a form with goApp.DoForm('myform', 'formname')

The MYFORM is the actual .SCX file name of the form. The FORMNAME is the value of the NAME property of the form. If I pass the FORMNAME parameter, my DOFORM method just activates the form if it exists. If the form is not already instanciated, I just issue a DO FORM (MYFORM)

If I do NOT pass the second parameter, then I open multiple instances of the form. I loop through the forms collection to see if FORMNAME exists.
lparameter tcForm, tcFormName
local llFound, i
llFound = .f.
i = 0
if !empty(tcFormName)
   for i = 1 to _screen.formcount
      if upper(_screen.forms(i).name) = tcFormName
         llFound = .t.
         exit
      endif
   endfor
endif
if llFound
   _screen.forms(i).Show()
else
   do form (tcForm)
endif
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform