Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VERY frustrated with Grid behavior. This should work.
Message
From
23/03/1998 03:42:17
 
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00086298
Message ID:
00086309
Views:
25
IT WORKS!!!!!!!!!!!!!!!!!!!!!!!!!!! Man I was going nuts!!!!!! I spent all day long searching in the UT and found several references to seemingly similar problems, but for some reason I wasn't finding threads that clicked in my head until I received the responses from you and Jim. Everyone seemed to be talking about similar but still different scenarios and there were only bits and pieces of why and the solutions. Thanks to both of you. Man this gets frustrating some times. I love VFP though. It's more fun than frustrating.

I think yours and Jim's responses should be posted in the FAQ of the UT. The key for me was finally getting an understanding of why it was happening from Jim (in other words, it's the normal 'feature' of the grid to behave this way), and then by decoupling the grid from the cursor ***before*** I screwed with the cursor again.

Thanks to both of you for your patience with answering this question, apparently for the umpteenth time.

-Rick

>>Hi,
>>
>>I have a form in VFP5a that has a grid on it, which has 3 columns and in the 3rd column there is a checkbox. The first works great when it is first instantiated. However I have a pulldown box that allows the user the choose a different table to populate the grid with. When they change tables for some reason, the grid gets all messed up, even though it's the exact same method that is being called when the form is first instantiated as when the user changes tables. When I say the grid gets messed up, I mean the columns go from 3 to 4 (which incidentally is how many columns there are in the resulting query, even though I only want to show 3 in the grid), the headings change from the headings I set at design time to the names of the result columns from the Select SQL statement, and the check box disappears and in it's place the logical field is shown with .F. in each field. WEIRD!!
>>Any ideas???
>>
>>
>>The following is the method code:
>>
>>if used("cust") && the table to select from into a cursor (make sure it is not being used)
>> sele cust
>> use
>>endif
>>
>>if used("temp") && the updateable cursors alias
>> sele temp
>> use
>>endif
>>
>>IF FILE(alltrim(gcUSADTDIR) + alltrim(files.path_name) + "cust.dbf")
>> sele 0
>> use (alltrim(gcUSADTDIR) + alltrim(files.path_name) + "cust") alias cust
>> sele name, addr1, .f. AS bSelected, cust_no from cust nofilter order by name into cursor tempcur
>> use dbf("tempcur") in 0 again alias temp
>> use in tempcur
>> sele temp
>> with thisform.cnt2.custgrid
>> .recordsource = "temp"
>> .column1.controlsource="temp.Name"
>> .column2.controlsource="temp.addr1"
>> .column3.controlsource="temp.bSelected"
>> endwith
>> thisform.cnt2.selectType.interactivechange()
>>endif
>>THISFORM.REFRESH()
>
>Hi Rick,
>
>This seems to be a very common problem on the thread. The simple solution to your problem is to decouple the grid from the cursor before you close it - i.e recreate it. :=
>
>THISFORM.cnt.custgrid.RecordSource = '(None)'
>
>*-- Play with the cursor
>
>and then you shouldn't even have to reassign the fields to the columns - that should be remembered.
>
>HTH
Previous
Reply
Map
View

Click here to load this message in the networking platform