Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SET VIEW TO filename is blanking out my grid
Message
From
19/08/1998 15:18:05
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00128144
Message ID:
00128244
Views:
28
>>>i execute a procedure which does a CREATE VIEW TO filename and then a SET VIEW TO filename. after the SET VIEW my grid is blank. i believe it does a create view because later it will close all the databases (have not executed that far into the logic yet).
>>>
>>>have read int ut to try the following, which i did:
>>>
>>> grid1.recordsurcetype = 0
>>> grid1.recordsource = ""
>>> set view to filename
>>> grid1.recordsourcetype = 1
>>> grid1.recordsource = "table1"
>>>
>>the recordsource = "", immediately loses my column controlsource. and then the set view still blanks my table.
>>>
>>>any suggestions would be appreciated. also, why does everyone on ut suggest recordsource = "" ? it does not allow your grid to keep its column controlsource, text formats, etc.
>>>>
>>>thanks - brenda
>
>>You have to restore not only Grid.Recordsource but also each Column.Controlsource programmatically. Setting recordsource="" prior to overrriding recordsource cursor will not harm, and actually it will save you from resetting also each Column.Width and ColumnOrder. Basically, it's one of ways to handle grid.
>There is another way, which is relevant if your grid recordset is small enough. This case, youcan CREATE CURSOR and base your grid on this cursor permanently. When you recollect new recordset, you just ZAP grid cursor and APPEND FROM new recordset. Here, the only thing you should do is Grid.Refresh
>
>my grid is updateable and the table has no unique key. this predictament leaves me with very few options other than a table recordsource. my form calls a procedure that is very involved. the proc does the create and set view. it also displays several modal forms, which do not hide the grid. all i want to accomplish is during the proc to keep the grid visually the same. i can removeobject("grid1") and createobject("grid1") when the proc returns control to my form. just do not want the client to see a goofy grid during the modal forms.
>
>thanks - brenda

Few things:
1.If your grid is updatable and you use view as grid.recordsource then it must have unique key, either data update will fail (actually kill underlying table).
2. The problem with multiple form interface can be resolved either by using private data sessions, or by creating separate cursor for the grid which will be updated by ZAP/APPEND FROM (as I told in previous reply). Table update in this case can be done by SEEKing in the underlying table using table/cursor primary key.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform