1

Konu: A couple of FoxyClasses questions

Hello:

I have, in Tools - Options - File Locations - File Type - Search Path (set as default):  d:\databases\class libraries\foxyclasses\classes\grids

In a prg file, I have

oListgrid = CREATEOBJECT("locatorgrid")

I get an error message that locatorgrid cannot be found. How come?

-------------

In locatorgrid, one is supposed to set CSQL to (for example): * from customer

However, if you have a complicated SQL statement saved to a cursor (name, e.g.): complsqlcurs), could you call this name instead in some way?

Regards,

Hans L

2

Re: A couple of FoxyClasses questions

Hans,
With createobject() it is not important that the VCX containing the class is in path or not. The VCX might be in your current folder, still it would give the same error. VFP doesn't search the vcx'es in search path for definitions, instead it checks the 'open' class libraries (set classlib to ....). While Set ClassLib would open a library and have its classes ready for createobject(), I strongly suggest using NewObject() instead.

With CreateObject("SomeClass") VFP would search the open class libs and create the object if it finds. However, if more than one class library have a definition for 'SomeClass' then there is no way that you can explicitly specify which one you are referring to.

With NewObject() -which is historically newer in the language- you can specify which class library to use (and it doesn't need to be in search path, you could directly write the full path). ie:

Visual Fox Pro
oListgrid = NEWOBJECT("locatorgrid", "d:\databases\class libraries\foxyclasses\classes\grids.vcx" )

For setting up cSQL you could do that in code too like this:

Visual Fox Pro
with thisform.locatorgrid1

        .cSQL = complsqlcurs.myDefinition
        .init()
endwtih

Calling init() code is important.

3

Re: A couple of FoxyClasses questions

Thanks a lot, Cetin.

Best regards,

Hans L

4

Re: A couple of FoxyClasses questions

cetinbasoz yazdı:


For setting up cSQL you could do that in code too like this:

Visual Fox Pro
with thisform.locatorgrid1

        .cSQL = complsqlcurs.myDefinition
        .init()
endwtih

Calling init() code is important.

Cetin, in implementing this, I realize that I do not know (and cannot figure out) what "myDefinition" stands for. I realize you made up the name, but what kind of animal is it?

Regards,

Hans L

5 Son düzenleyen, Efecan (18.09.2010 15:56:30)

Re: A couple of FoxyClasses questions

"However, if you have a complicated SQL statement saved to a cursor (name, e.g.): complsqlcurs),"
I thought you were sayıng that you keep your complex SQLs ın a cursor called "complsqlcurs" and I assumed the field name as mydefinition. In other words something like this:

Visual Fox Pro
replace complsqlcurs.myDefinition with "* from customer"

Or maybe I misinterpreted and complsqlcurs is directly the result of a complex SQL that you want to show? If latter then:

Visual Fox Pro
with thisform.locatorgrid1

        .cSQL = "* from complsqlcurs"
        .init()
endwith

PS: Efecan is my son and I was on his notebook. I didn't realize I was using his account.

6

Re: A couple of FoxyClasses questions

with thisform.locatorgrid1

        .cSQL = "* from complsqlcurs"

        .init()

endwith

Yes, this is most likely what I need. I'm quite sure of it. I will report back.

Thanks,

Hans L

7

Re: A couple of FoxyClasses questions

Hans tip of the day smile you can use for VFP code Syntax
"[code= visualfoxpro] && w/o space here after =
&& vfp codes
[/code]"&& w/o quotes
code block

or you can mark codes with mouse or keyboard then click the VFP icon above

8

Re: A couple of FoxyClasses questions

Tip of the day gratefully received, Soykan. smile   I always mark code with the mouse and then click the icon. Maybe I missed something this time, since there are, as I am sure you are implying, too many empty lines.
Thanks
Hans L

9

Re: A couple of FoxyClasses questions

You are welcome smile