Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grid Behaviour - (I give up)
Message
From
21/08/2000 05:54:30
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
19/08/2000 17:15:33
Terry Tuell
Stephens Production Company
Fort Smith, Arkansas, United States
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00407038
Message ID:
00407225
Views:
20
>After I posted my question, I discovered something else about the grid. For example, if the grid has a recordsource of a cursor and the contents of the cursor change, you have to rebuild the grid properties such as columnwidth, column.controlsource, etc. Apparently, when a recordsource for the grid is rebuilt, all methods assigned to the grid disappear as well.
>
>When I first go into the form, all methods work perfectly. But the recordsource, which is a temporary work table created through an SQL statement, is reconstructed through user interaction.
>
>Now that I've found the source of the problem, I think I'm going to have to re-design this thing so my grid's recordsource remains constant throughout the session. In other words, I'm going to have to build a true Parent - Child relationship. Unless someone out there knows how to keep my methods active after the grid's recordsource is changed?
>
>Anyway, thanks for your input.


Terry,
This would occur if recordsource is changed directly or currentcontrol is something else (thus text1 events never fire). Yours is the first as I understand. You have more than one ways to keep it working the way you want :
1)
with thisform.myGrid
 .Recordsource = ''
 * Changes to recordsource
 .Recordsource = 'myCursor'
endwith
2)
*Grid.init
lcSQL = 'select ... from ...'+ ;
'where somefield = thisform.somecontrol.value into cursor myCursor'
with this
 .RecordSourceType = 4 && SQL
 .RecordSource = lcSQL
endwith
Latter works if you have an index for the where part (ie: if it's where Last_name = thiasform.myText.Vaue then you should have an index on last_name). All you need is to call grid.refresh where appropriate say myText.Lostfocus. Of course it's a readonly solution.
3)Grid is based on a view. You only need to requery('myView') and refresh grid.
4)A grid class that sets its headings, controlsources etc via its own methods. You could removeobject current grid, prepare cursor and addobject the class.
5)Saveasclass a grid originating from a vcx, removeobject grid, prepare cursor, addobject saved grid class.
Etc.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform