Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Resetting grids
Message
 
 
À
10/11/1998 16:23:47
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
Divers
Thread ID:
00156378
Message ID:
00156402
Vues:
42
>>>>>>In my grid class, I put code to set up the grid according to saved settings:
>>>>>>
>>>>>>
>>>>>>      RESTORE FROM MEMO Settings ADDITIVE
>>>>>>      THIS.RecordSource = THIS.RecordSource
>>>>>>      FOR i = 1 TO THIS.ColumnCount
>>>>>>         THIS.Columns[i].Header1.Caption = laSets[i,1]
>>>>>>         THIS.Columns[i].ControlSource = laSets[i,2]
>>>>>>         THIS.Columns[i].Width = laSets[i,3]
>>>>>>         THIS.Columns[i].ColumnOrder = laSets[i,4]
>>>>>>      ENDFOR
>>>>>>
>>>>>>
>>>>>>For the most part this works, but there's one problem. Comboboxes in the grid don't initialize. I have the cbo rowsource as an SQL statement and the rstype as SQL. When I don't have this code in the grid, the combobox opens a table and creates a cursor and populates itself. With the code, it doesn't do any of that.
>>>>>>
>>>>>>I've narrowed it down to it being setting the controlsource that's causing this. Without that line, the cbos work. Unfortunately, without that line the columns have no control sources.
>>>>>>
>>>>>>Any idea what I can do to make this work?
>>>>>>
>>>>>>Thanks,
>>>>>>
>>>>>>-Michelle
>>>>>
>>>>>How big is grid.recordsource (i mean number of records)?
>>>>
>>>>About 7 right now. Just test data.
>>>>
>>>>-Michelle
>>>
>>>No, I'm asking about real size. Also, what is this, view or cursor?
>>
>>It's a view. You mean what size will it be with real data? Probably not more than a thousand records.
>>
>>Thanks,
>>
>>-Michelle
>
>AFAIK, view doesn't require GRID.Recordsource=Grid.Recordsource line. If you cannot remove this line then you have two alternatives: either enforce combo by Column.RemoveObject/AddObject (combo should be instanciated from class with needed code in Combo.Init event), or populate grid from read-write cursor which takes data from your view (here you don't need in restoring grid settings).

I don't know if it's required; I just figured better safe than sorry. The grid doesn't know if it's source is a view, table, or cursor.

Actually, there's a third workaround that's not so complicated. I just have to move the SQL to the init of the combobox. I was just hoping there was a way to fix it in the grid class so I don't have to put that restriction on the comboboxes.

Oh well, can't win 'em all. :)

Thanks for your help.

-Michelle
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform