Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing methods programatically?
Message
De
13/09/1999 11:00:01
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00263848
Message ID:
00263997
Vues:
40
>>Nearly all of the time when a programmer thinks she needs to write code at runtime, it is because she can not think of a better way to do it. For example, Christian's needs could and should be taken care of with classes. Put the code that you want in a class definition, and add it at runtime.
>>
>
>Erik,
>
>I hope you're right by saying that I don't even need to write code at runtime. The need for this came through a weired problem which I encountered with my grid:
>The grid is instantiated within the form (in the form designer), and all my code and methods and properties are edited there. So is my GotFocus event etc.
>What happens is, that when I change a few properties of the grid (RecordSource of the grid, Controlsource of the Columns, Width of the columns etc), then the Gotfocus events of my textboxes are gone! I didn't expect this behavior.
>Maybe I do something else wrong?

No. You have encountered what I consider to be a bug with grids, but some would call it "by design". When you yank a grid's recordsource out from under it while it is live, it sort of goes crazy, and forgets specific formatting information.

Gnerally, when I need to do something like this, rather than changing the recordsource from one identically structured cursor to another, I just ZAP the underlying cursor, and append new contents. If however, you really do need to change the recordsource, then subclass the controls in the grid with code in them, and AddOBject from the classes at runtime.
Erik Moore
Clientelligence
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform