Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing a class method
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00755091
Message ID:
00755178
Views:
9
Thanks, I'll give these a try....
Rick
-----------------------------------
>>Hi Fred, thanks for trying to help.
>>Here's the info you requested.
>>
>>I open the dbc when I start my app...do I need to do it again in the form I placed the timer on?
>>
>>The form has a private datasession and all the required tables are opened before this line of code is called.
>>
>>The timer, obs_web_import_timer, is in a class called OFAX.
>>
>>I created the class via the VFP project by going to the classes tab, selecting the OFAX class and clicking NEW.
>>
>>I've placed the timer/class on a form called hidden_timer. This is a modless form and the form's visilble property is set to .F. and the form is called with the NOSHOW option (DO FORM Hidden_Timer NOSHOW). I did this to allow the timer to have a Private Datasession.
>>
>>For all intents and purposes, all my forms use Private DataSessions with optimistic table buffering.
>>
>>I've tried calling the code I need like the following:
>>m.L_ID = obs_web_import_timer.GetNextID("LOCATION")
>
>This should work, but I bet it doesn't because the form is a Private Datasession form, and your timer object was more than likely created before the form was started, and therefore it lives in the VFP default datasession, different than the form's.
>
>>m.L_ID = This.GetNextID("LOCATION") && why didn't this work???
>
>Because the GetNextID method doesn't belong to whatever object that your trying to call it from. "this" refernces the ccurrent object, not your timer object.
>
>>m.L_ID = ThisForm.GetNextID("LOCATION") && there is no form method
>
>Similar to above. If you put the code in your base class form (you do use a base class form, don't you?) or even as a method on this particular form, that would solve the datasession issue.
>
>>m.L_ID = GetNextID("LOCATION") && this is a class method
>
>For a class method, it needs to be like your first line of code.
>
>>m.L_ID = NextID("LOCATION") && this is in the RI
>>
>>Before I placed the timer on the form, I used to just instanciate to object during my main program's startup, and I used the last line
>>m.L_ID = NextID("LOCATION")
>>That seemed to work...
>>
>>but after I put it on the form it seemed to stop working
>
>Once you put the timer on the form, that should also solve the datasession issues as the timer will now participate in the same datasession as the form. But what would change is how you reference the timer. It would now be "thisform.YourTimerObject.GetNextID("LOCATION")" instead of the direct object reference.
>
>If you actually have the NEXTID code as a stored procedure to your database container, as long as the database is the current one, you should be able to call it with just NextID("LOCATION"), just like a regular program. Think of stored procedures in a database as being very similar to using a regular procedure file, you just don't need the SET PROCEDURE TO in order to find it, it should automatically included. I'd also suggest you look more closely at the TAZTRADER sample app if you have it in VFP5,6 or 7, it's no longer part of VFP8.
>
>>
>>I hope that helps, I really need to resolve this and move on!
>>Thanks!
>>Rick
>>-----------------------------
>
>Hope this helps!
Previous
Reply
Map
View

Click here to load this message in the networking platform