Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
DblClick in the Grid
Message
 
À
22/06/2000 13:49:22
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00382904
Message ID:
00383353
Vues:
22
I don't usually add columns to grids programmatically, so take this with a grain of salt. *s*

I believe there's a bug in VFP that can mess you up when you add a column to a grid that starts with 0 columns. You end up having an extra column called Column0. Instead, just leave the ColumnCount of your GC at -1.

In order to add any field mappings or your own control classes to the grid, you first have to set the grid's ColumnCount to something other than 0 or -1. But you can do this generically, if you want to map all the fields in the current table:
for li = 1 to fcount()
   listr = alltrim(str(li))
   grid.addobject('Column'+listr, columnclass)
   grid.column&listr..addobject('MyTextBox', textboxclass)
   grid.column&listr..currentcontrol = 'MyTextBox'
   grid.column&listr..controlsource = field(li)
endfor


>I guess there's a little misunderstanding - thats my fault, so i'll try to make it as clear as possible.
>
>1. I subclass a grid. By default it does not have any columns, textboxes, etc. Just plain grid container.
>
>2. I add my grid class (GC) to the form. When I need my GC to show a different table, I'd set its RecordSource to that table and refresh the grid.
>
>3. After refresh, all the columns and controls inside the grid are created by default field mappings, without my intervention. The only thing I do programmatically is DeleteColumns (all of 'em) before changing RecordSource.
>
>4. How do I change field mappings for my grid class from default VFP textbox to subclassed textbox without adding any columns to the grid class (keeping ColumnCount = 0)? Is this possible?
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform