Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids
Message
From
05/03/1999 11:42:05
James Beerbower
James Beerbower Enterprises
Hochheim Am Main, Germany
 
 
To
05/03/1999 11:15:26
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Re: Grids
Miscellaneous
Thread ID:
00194494
Message ID:
00194544
Views:
25
>>>>>How can I rebuild an underlying(recordsource) cursor without loosing grids' design?
>>>>>Thanks Mark
>>>>
>>>>lcRecordSource = ogrd.RecordSource
>>>>ogrd.RecordSource = ''
>>>>RebuildCursor()
>>>>grdRecordSource = lcRecordSource
>>>>
>>>>I'm not sure why people want to store all the column values. Maybe I'm missing something? But I sure have a lot of grids that work this way without problem...
>>>
>>>>James Beerbower
>>>>Qsys/VCA
>>>>USA/Deutschland
>>>
>>>Have you ever tried it for a grid with expression in column.controlsource?
>>Yes. Calculations and so on. IIFs and so on. What's the problem?
>>
>>James Beerbower
>
>Hmm... I just made quick test (VFP5a): (I do it not the first time)
>I drop some table to form and got a grid, then I go to property sheet, select the second column and changed controlsource from the second field (default) of the table to the first one. Now I run the form, and as it should be grid shows the same values in the first and second columns. Ok, I return to form designer, drop a button on the form with code in click event
>thisform.grid1.recordsource=""
>thisform.grid1.recordsource="table1"
>thisform.grid1.refresh
>I start the form, get the grid with the same values in the first two columns, click the button, and see that the values in the second column restored to the second field of the table i.e. to 'default' settings. As I mentioned before, for some irrational reasons, it does not always happen (however, I think this simple test should give the same results everywhere), but my UT experience confirmed many times that the problem exists.
>

I think Marks response clarifies the issue a bit. I don't bind columns at design time -- only at run time:

do form myform name oscreen link noshow
oScreen.InitUI() && Makes Grids among other things.
oScreen.Show()

func InitUI()
MakeGridOne()
MakeGridTwo
endfunc

func MakeGrid
o = THISFORM.oControl && Business object
WITH THISFORM.oGrd
.RecordSource = o.QueryMyTable()
.SetAll('FontName','MS San Serif')

m.i = 1

* Part Numbers
.Columns(m.i).ControlSource = o.GetExpr('PartNumber')
m.i = m.i + 1

* Stock Numers
.Columns(m.i).ControlSource = o.GetExpr('NSN')
m.i = m.i + 1

* And so on
ENDWITH

I really loath opening up the property sheet to set values. It takes forever and hurts my hands to use the mouse so much. And I can use the excellent CEE to write this code very fast. I can move columns around without having to think about it. And I can find a code problem a lot faster than a mis-set property. But everyone has different preferences. You do have to set the recordsource at design time to space(1) ' ' because VFP understands 'none' to be whatever table happens to be open...

And Thanks for the response! I had read your suggestion in several other places and never saw the reason...

James Beerbower
James Beerbower
James Beerbower Enterprises
Frankfurt, Deutschland
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform