Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cursor in a grid
Message
From
07/03/2007 11:52:25
Dragan Nedeljkovich
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 7 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01201093
Message ID:
01201585
Views:
33
>>1. The initial dummy select - doesn't that belong in a different method? Otherwise it would be getting created again, anyway, every time you call the method to refresh the grid with the newly selected data?
>>
>>The initial select is not a dummy select. You need to SELECT ... INTO CURSOR READWRITE NOFILTER in the load of your form so you can bind the grid
>
>Well I interpret it as a dummy in that it creates the cursor for reuse.
>The main thing is that's done once, at form init or load, rather than being lumped in with the rest of the safe select code as in Andy's paper, and thus done again and again.

I'm actually not doing an initial select. I create cursor (...) so it's exactly what I want, and I do it in form's load, or init, or if I'm building a grid programmatically, in grid's init.

>>2. You talk about the extra code necessary (presumably to "shape" the grid.) but where does the grid formatting, and field-to-grid column allocation happen, if you don't select the data in the order in which it should appear on the grid.
>>
>>ZAPping the grid's recordSOurce foes not close it. So if you use the "safe select" method described in Andy's blog, the grid does not lose any formatting.
>
>Aye, but as the cols don't have a .controlsource, isn't it down to the order of select of the csr to determine which fields go where in the grid? otherise you're back to coding the grid set-up.

My trick for this is to set the grid's recordsource and all the columns' controlsources at design time, and then just make sure all of them exist at runtime. I have to confess that I'm doing almost all of it in command window :).

Last time I was just lazy, so I ran the create cursor statement, then copied the cursor into a free table with the same name, added that table to form's DE, dropped the table from there into the form - which gave me the default grid with pretty much everything in place. Then I removed the DE, deleted the table, and ran the form. The trouble with this approach is the 10-character limitation on field names.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform