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:
00755135
Views:
10
>>------------------------------
>>I created a class (obs_web_import_timer), which has one control on it, a timer.
>>When the timer event fires the timer checks a table for undeleted content.
>>If it find any undeleted records, in creates records in my Orders.dbf, OrderItems.dbf and Location.dbf.
>>When before creating the location record it needs a number for a unique ID. My DBC is called OFAX and in it I have a routine in my RI code called NextID. NextID is what I would use but when I try to use it I can't find it. So I created a class method called GetNextID, which has the same code in it as the RI code for NextID. Even tho I now have this as a PUBLIC method, I still can't find it.
>>
>>I must be calling it wrong.
>>What would be the proper syntax?
>>Is there a way to call the RI codes NextID?
>>
>>My next step would be to create a PRG for GetNextID, but that seems like a wrong solution.
>>
>>please help
>>
>>Rick
>>------------------------------
>
>So, how are you attempting to call this new method you've created? Are you using Private DataSessions? Where was your timer class created? Is it in a different data session thean where the data resides?
>
>Lots more details are required to pin this down.
-------------------------
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")
m.L_ID = This.GetNextID("LOCATION") && why didn't this work???
m.L_ID = ThisForm.GetNextID("LOCATION") && there is no form method
m.L_ID = GetNextID("LOCATION") && this is a class method
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


I hope that helps, I really need to resolve this and move on!
Thanks!
Rick
-----------------------------
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform