Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BINDEVENT at INIT
Message
 
 
À
16/05/2007 11:56:34
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01226051
Message ID:
01226057
Vues:
16
Hi Larry,

1) I think you should be able BindEvent to form's methods in CA's init. I haven't tried in CA, but I did this for other inner objects in container hierarchy and it worked fine. Re-check your code.

2) From the Init of one form's object you can not reference another form's object. That's a generic rule and it is better not to break it. Of course, various workarounds exist, but better to move this code into form's Init when all objects are already available.


>Hi All,
>
>I have two questions in one:
>
>1. How do I get a BINDEVENT to work in the INIT of a Cursor Adapter, where the bind is on a THISFORM.Method reference?
>
>I have a base textbox class with a BINDEVENT like:
>
>
>BINDEVENT(THISFORM, "update_form_controls", THIS, "set_for_state", 1)
>
>
>This action works. A call to THISFORM.update_form_controls fires the Control.set_for_state method on each control on the form. Apparently, the THISFORM in the BINDEVENT command in the INIT of the control is able to resolve the THISFORM reference at INIT-time.
>
>However -- I place the same type of BINDEVENT in the INIT of a Cursor Adapter class and the action fails. Anyone know why?
>
>
>2. How do I get a good THISFORM reference at INIT-time?
>
>At INIT-time, I have a form control that wants to pull its data from a collection object on the form. It looks like:
>
>
>THISFORM.o_form_coll && <-- the form collection with the control data.
>
>
>Inside the control INIT is:
>
>
>lo_form = THISFORM && <-- point of failure because THISFORM is not yet valid.
>lo_coll = lo_form.o_form_coll
>lv_data = lo_coll.get_data(THIS.c_csr_dot_field)
>
>
>I know I am not the first person to address this and somewhere in the past I have seen and implemented strategies to handle it, but cannot remember what I or others did.
>
>Thanks in advance for your help.
>
>Larry
If it's not broken, fix it until it is.


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

Click here to load this message in the networking platform