Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
CursorAdapter Class Questions
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00888575
Message ID:
00888613
Views:
10
>I have create a class that encapsulates the cursoradapater.
>
>After I call CursorFill and return back from the class, the
>cursor closes. What do I need to do to keep the cursor open?
>
>Second, Im trying to make this class generic, yet the UpdatableFieldList
>and UpdateNameList properties are specific to the table. I really dont
>want to pass them in as parameters. Any other ideas?
>
>Many thanks

I am assuming you are creating a CA object that is then opening a cursor. Once the code runs, the variable that you used to hold the object reference then loses scope so the CA is destroyed. When that happens, the cursor also closes. e.g. --

local oCA
oCA = createobject('MyCAClass')
* other code here
return

As soon as you return oCA loses scope, the object is destroyed and the cursor is destroyed along with it.

You have at least 3 options. Make oCA a public variable. Add a property to a global app object to hold the object reference [goApp.oCA = createobject('MyCAClass')], or you can "disconnect" the cursor from the CA before returning by calling the oCA.CursorDetach() method. The oCA will still be destroyed but the cursor will now be left behind.

For making it generic, you could use something like AFIELDS() in the AfterCursorFill method to help populate those properties. It would help if you could always depend on the name of the PK field[s] always being the same for every table though. Maybe my CA VCX Builder would be of help to you. It is free and comes with source code and extensive comments about the CA in the CABuilder.PRG file. Just click the FoxPro Tools link at http://www.mctweedle.com
Mark McCasland
Midlothian, TX USA
Previous
Reply
Map
View

Click here to load this message in the networking platform