Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Grid question
Message
De
27/05/2003 09:54:11
 
 
À
27/05/2003 09:09:58
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
Divers
Thread ID:
00792933
Message ID:
00793073
Vues:
62
Hi Jim.

That's really neat, Marcia, but I'm still scared by the idea of having BINDEVENT() coded all over the place in an application.

Oh I have no doubt that there are all kinds of creative ways in which the developer can shoot himself (or herself < s > ) in the foot by using BINDEVENT() indiscriminately.

I have found it useful in a couple of instances where I needed to change the behavior or controls that could not be accomplished very conveniently in any other way. For example, in the application that I am working on now, I added a method called SetDefaultValue() to my combo boxes so that a default value could be set when a new record is added to the cursor. The default code just sets the combo's list index to 1. But I did not want to go into all of my forms and call that method from the form's AfterAddNew() method for any of the combo boxes on that form. What I did instead was add 2 properties to my combo box:

cHandlerName: default is Thisform
cHandlerMethod: default is AfterAddNew

add this code to the combo box's init():
IF NOT EMPTY( This.cHandlerName ) AND NOT EMPTY( This.cHandlerMethod )
  IF PEMSTATUS( EVALUATE( This.cHandlerName ), This.cHandlerMethod, 5 )
    BINDEVENT( EVALUATE( This.cHandlerName ), This.cHandlerMethod, This, 'SetDefaultValue' )
  ENDIF
ENDIF
I thought it was a pretty elegant solution to my problem < s >.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform