Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Change grid column controlsource?
Message
De
04/10/2001 21:58:28
 
 
À
04/10/2001 14:23:40
Peter Brama
West Pointe Enterprises
Detroit, Michigan, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00564369
Message ID:
00564590
Vues:
15
>It was recommended that to keep a grid from crashing when I delete the table's records and refill them with new ones... I should:
>- use COPY STRUCTURE to create a temporary file with proper structure
>- change the grids RECORDSOURCE to the new structure
>- change the grids columns CONTROLSOURCE to the new structure
>- change the delete the old source file and recreate the data
>- change the grids RECORDSOURCE to the recreated file
>- change the grids columns CONTROLSOURCE to the new structure
>
>How do you change the CONTROLSOURCE... I tried thisform.grid1.columns(1).controlsource= and I get an error of unknown item.

Well, you seem do too much..
With ThisForm.GrdData
   .RecordSource = ""
   .ColumnCount = -1     && Release all column objects, *notes
   Select Customer
   .RecordSource = "Customer"
   .Init     && If you give some proc on init to setting the grd, such as textbox, header...
   .Refresh
EndWith
*Notes: Once you change the GrdData.recordsource, all columns objects are auto-Reset.
i.e. any code on column, header, textbox will gone forever!

If you don't reset the columncount to -1, the column.width will follow old alias..
Of cos, most likely the layout width is wrong.

Now, reset everything and try to give all setting on INIT event.

For example:
* GrdData.Init
With This
For iX = 1 to .ColumnCount
   .Columns[iX].RemoveObject([text1])
   IF TYPE(.Columns[iX].Controlsource) = [N]
       .Columns[iX].AddObject([text1], [txtNum])   && self-numeric textbox class
   ELSE
       .Columns[iX].AddObject([text1], [txt])   && self-define own text, you can put code here.
   ENDIF
   .Columns[iX].text1.fontsize = 11
   .Columns[iX].text1.fontname = "Arial"
   .Columns[iX].text1.visible = .T.   && default visible value was .F. by Addobject()
EndFor
EndWith
The weak wait for chance, The strong bid for chance,
The clever notch up chance, but The merciful give you chance.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform