Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Modeless Form
Message
 
 
To
15/06/2001 00:19:51
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00519824
Message ID:
00519829
Views:
13
Carmen,

Are you sure that your users will not want to have independent instances of Form1 open at the same time?

You can use a form menu manager to handle this. It can iterate through the _screen.Forms[] collection and just activate the existing form. Your menu code could look like:
=FormManager( "frmClient", "client" )

* FormManager.prg (could also be a method of an object)
function FormManager( pcFormName, pcSCXFile )

local llFound, loForm
llFound = .f.

for each loForm in _screen.Forms
   if ( loForm.Name == pcFormName )
      * found it, so bring it on top
      llFound = .t.
      loForm.Activate()
      exit
   endif
endfor

if ( ! llFound )
   * not running so start an instance
   do form (pcSCXFile)
endif

return
>I have two form called form1 and form2, all in modeless type.
>Once i click on the form1 on the menu, then the form1 will displayed, so then
>i click on the form2 from the menu without closing the form1. The form1 will stay behind the form2. The Question is If I go to the menu click Form1, the another form1 will be diplayed. therefore totally three have displayed. How do i make it the original form1 will go infront instead of calling another form1 again.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform