Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mixed case property names

Status
Not open for further replies.

Mike Lewis

Programmer
Joined
Jan 10, 2003
Messages
17,516
Location
Scotland

I'm writing a little Property Inspector form. Basically, it displays the property values for a specified object at run time. I am using AMEMBERS() to get a list of the properties, and GETPEM() to find their values.

It all works very nicely, except for one irritation: AMEMBERS() returns the property names in capitals. I would prefer to show them in the same case as in VFP's property window. For example, BackColor rather than BACKCOLOR.

Does anyone know of any way of programmatically retrieving property names in mixed case? I wondered about using ALANGUAGE(), but that works with commands, functions and base objects, not properties.

It's not a show-stopper, but if I could avoid showing all caps in my Property Inspector, I would like to do so.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Hello Mike,

If you open the foxcode.dbf you'll see there are some properties in it, unfortunately only few that have some special behaviour like .BackColor, .ForeColor, .Icon, .Picture...

Well, the list of properly cased properties has to be somewhere, as Intellisense is displaying property names proper, eg when typing _screen. you get a combobox of all the properties with correct CamelCase.

There is a class "FoxCodeScript" that has a method AdjustCase. If you Google "FoxCodeScript AdjustCase" you don't find much, but maybe that's a starter...

I haven't figured out myself how to make use of it, but it seems promising.

Bye, Olaf.
 

Olaf,

Thanks for your reply. I had already checked the Foxcode table and noticed that only a few properties were present. They seem to be the ones that lead to an action, such as opening the colour picker to set a BackColor.

You're right of course that the list of standard-cased properties must be present somewhere, but I'm durned if I can see where.

I tried you idea of googling, and found an article by Andy Kramek about writing Intellisense scripts, which mentioned the AdjustCase() function, but so far I haven't figured out how to use it outside the purlieu of a script.

Could be the whole thing will be too much trouble, and I will have to live with seeing my property list in all caps, but I'd like to find a solution if there is one.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
In some Data Memos of the foxcode.dbf one can see a little sample code. The class FoxCodeScript seems to be defined in _CODESENSE:
Code:
SET PROCEDURE TO (_CODESENSE) ADDITIVE
oMrProper = CreateObject("FoxCodeScript")

You can create a FoxCodeScript object, but then? I didn't figure out what to do next, tried calls to AdjustCase, but they returned nothing. Well, as I'm even just guessing that it might do what can be expected by the name, AdjustCase may need the environment of an edit window and does adjust the case of the command keyword last typed.

So I fear you're right, this is of no real use outside of Intellisense scripts.

Bye, Olaf.
 
Another caveat to this is that VFP objects seem to all be converted to uppercase.
For example, this chunk of code:
Code:
oMemList = CreateObject('excel.application')
AMEMBERS(aList, oMemList, 3)
Will give you the members of the Excel object in the original case.
Whereas a VFP created form instantiated as an object gives you a list in all uppercase:
Code:
MODIFY FORM someform
...make some changes...
...save as class....
SET CLASSLIB TO theclass
oMyForm.CreateObject('theclass')
AMEMBERS(aList, oMemList, 3)

-Dave Summers-
[cheers]
Even more Fox stuff at:
 

Olaf,

I just tried your suggestion. I wrote a little program to call AdjustCase() 26 times, passing A to Z as the second param. It seems that L, P, and U convert the case to lower, proper and upper respectively, and M keeps it the same. All other values have no effect.

This doesn't get me any further forward, but still, it's an interesting experiment. Thanks for the idea.

Craig,

Thanks for that.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 

OK, I've got the solution.

My thanks to Tamar, who told be about a file called fdkeywrd.dbf, in the Wizards directory. This contains most of the VFP keywords, including (as far as I can see) all the built-in property and method names, in their correct case. Problem solved.

I never would have thought to look in the Wizards directory. Maybe I should find time to explore it to see what other good stuff it contains.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Mike,

No problem.
But after rereading my post, sorry for the typo:
Code:
MODIFY FORM someform
...make some changes...
...save as class....
SET CLASSLIB TO theclass
oMyForm.CreateObject('theclass')
AMEMBERS(aList, [COLOR=red]oMyForm[/color], 3)

Anyay, we knew it had to be there somewhere!

-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi Mike,

thanks for posting the solution. Sometimes it's even easier than one could imagine.

Bye, Olaf.
 

Olaf,

Well, I knew there had to be a list of correctly-cased property names somewhere in the depths of VFP. As you said yourself, Intellisense uses them, and it's hardly likely they were hard-coded.

I just needed someone to point me in the right direction. I would never have thought to look in the Wizards directory.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
The file I pointed you to is used by the Documenting Wizard. I'm sure there's something in the VFP executable as well, but I have no idea how to get my hands on it.

Tamar
 

Tamar,

I'm sure there's something in the VFP executable as well

Yes, there must be something that populates the property window in the form/class designer. Maybe it's hard-coded within VFP.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

My sites:
Visual FoxPro (www.ml-consult.demon.co.uk)
Crystal Reports (www.ml-crystal.com)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top