Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Same old problem again
Message
 
 
À
15/12/2005 15:18:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01078218
Message ID:
01078440
Vues:
28
There is such method in MereMortals forms. In my case dodefault() was to execute the default code in Query Unload. I've created a special Data Entry class form which is a subclass of BaseBizObject form.

>llReturn = dodefault()
>
>The default behavior is to close the form.
>
>You might want to consider adding a method to your form class called WriteBuffer and call that method from the QueryUnload() as well as from any method that is called from the click of a toolbar button or menu ( since toolbar buttgons and menus do not get focus ). If WriteBuffer returns .F., issue a NODEFAULT in the QueryUnload(). Code in WriteBuffer() follows:
>
>
>LOCAL loColumn, loActiveControl, loControl, llRetVal
>
>llRetVal = .T.
>IF TYPE( 'Thisform.ActiveControl.Name' ) = 'C'
>  loActiveControl = Thisform.ActiveControl
>  IF UPPER( loActiveControl.BaseClass ) # 'GRID'
>    *** If there is code in the valid method of the active control
>    *** And the entry is invalid, the error message will display
>    *** But the rest of the code code will continue to run and save
>    *** the bad data anyway. So we cannot just issue a SetFocus()
>    IF NOT EMPTY( loActiveControl.Valid() )
>      *** We still have to cause the Valid to fire to update the data
>      *** from what is in the buffer because the previous line
>      *** does not cause the Valid to fire, it merely runs any code
>      *** in that method
>      loActiveControl.SetFocus()
>      llRetVal = .T.
>    ELSE
>      llretVal = .F.
>    ENDIF
>  ELSE
>    FOR EACH loColumn IN loActiveControl.Columns
>      IF loActiveControl.ActiveColumn = loColumn.ColumnOrder
>        loControl = EVAL( 'loColumn.'+ loColumn.CurrentControl )
>        IF NOT EMPTY( loControl.Valid() )
>          loControl.SetFocus()
>          llRetVal = .T.
>        ELSE
>          llRetVal = .F.
>        ENDIF
>        EXIT
>      ENDIF
>    ENDFOR
>  ENDIF
>ENDIF
>
>RETURN llRetVal
>
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform