Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Grids & CursorAdapter CursorFill()
Message
 
 
To
07/01/2011 00:53:56
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MySQL
Application:
Desktop
Miscellaneous
Thread ID:
01494587
Message ID:
01495360
Views:
177
Dennis,

Why not try? There's nothing to lose in trying it. Although I am no longer doing VFP codes, what we do is all cursors, objects, temporary file tables are constructed in the load event so that everything are available in the Init event.

I think it's worth a try. Or try issue Wait Window timeout 1 before assigning the CA or tempcursor to grid recordsource property then refresh.

>Jess,
>
>Everything is in the Init event since there is nothing to do in Load. The form class basically accepts a CA object parameter which serves as the cursor that populates the grid. The Init also calls a form method to programatically construct each column of the grid based on the cursor's structure. The form also has other controls to either filter or change the order of the cursor.
>
>Previously, whatever fields the cursor has is displayed on the grid. This works like a charm.
>
>I then decided to refine it further by allowing only a subset of the fields be displayed on the grid. This is where the 'nightmare' began. The grid deconstructs. That is why I shifted to safe select - use a temporary cursor which has the subset of fields as the RecordSource. So, everytime the CA CursorFill() is called, we ZAP the Tempcursor and APPEND FROM DBF( CA.Alias ). All the data shows up correctly when you view in the Data Session window, only thing is, the grid does not display the records. One needs to either keypress UP or DOWN for the rows to appear. Thats why for now, I issue KEYBOARD '{UPARROW}' as a remedy, albeit poor one.
>
>Thanks for your ideas.
>
>Dennis
>
>
>>Di you to build TempCursor in the Load event rather than in Init event.
>>
>>>Naomi,
>>>
>>>Are you adding a grid in the Init in run-time when the cursor is created? Otherwise I don't understand. The grid must have a RecordSource, what is its RecordSource ?
>>>
>>>The grid is already dropped during design time, but with no RecordSource or other details yet. It is in the form's Init where a TempCursor is created from the passed CA object, then programmatically assigned as RecordSource of the grid together with the building of the columns.
>>>
>>>
>>>>>I did use Safe select approach with the CA. The grid's RecordSource was a cursor created in the Load method of the form. I then used CA for the search and even re-builded its SelectCmd. But since the grid's RecordSource was a different cursor, manipulations with the CA didn't affect it at all.
>>>>>
>>>>>In my case, the CA object is passed to the form, so, it is in the Init event when the cursor was created. The form also rebuild the SelectCmd prior to another call to CursorFill(). The grid is programmatically a tempcursor RecordSource with exactly the same structure as the CA cursor. So, whenever CursorFill() is called, it tells the grid to zap the temp cursor, and append from the newly CursorFill'ed CA. Then the grid refreshes, GOes TOP, and SetFocus().
>>>>>
>>>>>Dennis
>>>>
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net

CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform