Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Prevent user to open form second time
Message
De
27/01/2005 06:57:54
 
 
À
26/01/2005 10:18:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 7
OS:
Windows XP
Network:
Novell 4.x
Database:
Visual FoxPro
Divers
Thread ID:
00980766
Message ID:
00981149
Vues:
28
>Hi,
>
>Is there any way to prevent users to open an already open form twice.
>I made command button disable after open a form. But when the form release this command button does not enable.
>
>Please suggest me. Thanks - Saif

Sai'

I use the following two functions:
* Proc sysOpenForm
* ________________
* If a named form is not already open, open it by physical name
* Else just ignore
* 1st param = .name property in form, 2nd = name stored on disc, e.g. CustForm (.frx)
* ________________
LPARAMETERS	tcFormName, tcPhysName, tcObjectName
LOCAL		lnNoParms

lnNoParms	= PARAMETERS()
If not sysFormOpen( tcFormName) > 0	&& If supplied form not already open
    If lnNoParms = 3		&& If want an object name with it too
	do FORM &tcPhysName Name &tcObjectName
    Else
	do FORM &tcPhysName
    Endif
Endif
* Func sysFormOpen
* ________________
* Supplied with a form's name property, go thru list of
* open forms to see if that form is open.
* __________________________
LPARAMETER tcFormName
LOCAL	  lnFormCount, llOpen, lnFormNo, lnOpenFormNo

llOpen			= .F.
lnFormCount 		= _SCREEN.FormCount
lnOpenFormNo		= 0
If lnFormCount > 0
    lnFormNo 		= 1
    Do WHILE lnFormNo <= lnFormCount ;
	AND not llOpen
      If ALLTRIM( LOWER( _SCREEN.Forms( lnFormNo).Name)) = ALLTRIM( LOWER( tcFormName))
          llOpen		= .T.
	 lnOpenFormNo	= lnFormNo
      Else
	 lnFormNo		= lnFormNo + 1
      Endif
  EndDo
Endif

Return lnOpenFormNo		&& index of specified inquiry form
So, instead of issuing "do form CustDets" you issue:

= sysOpenForm( "CustDets", "CustDets", "loCustForm")

Works fine for me. HTH

Terry
- Whoever said that women are the weaker sex never tried to wrest the bedclothes off one in the middle of the night
- Worry is the interest you pay, in advance, for a loan that you may never need to take out.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform