OzFox2007 - Get(Objx) more productive
I am back from an extremely intense OzFox 2007 and I must say it was very well organised by Craig Bailey of Talman. It was great to meet other VFP users from Australia and overseas and put faces to names.
One of the sessions was Get moreProductive with VFP by Rick Schummer where he did an interactive session on enhancements we can create ourselves to make our development life easier. There were a lot of ideas brought up that were really timesavers and really cool and Rick did a really good job of describing them and the various techniques where we can save a lot of effort and time.
How many of us have these forms with objects buired deep in them. Like this sample form below:

One of the things Rick showed was how you can open a code window and Right-Click in it to bring up the menu and select "Object List" to bring up the window as shown below, where clicking on the object inserts the complete path to that object into your code.

Now while this is fine when there are a few objects it becomes very much more difficult when there are literally a thousand objects in that list. Even a few hundred would make searching that list a nightmare and make it faster to use intellisense and type in the code.
I have a solution I would like to share, that takes away all these problems and works in an instant. That is my GetObj.PRG file. In my VFPStart.prg I call this program and it resides in my VFP root folder. This hooks into the CTRL+H key combination, but you can easily change that. The code is shown below:
ON KEY LABEL
CTRL+H do getobjX in c:\vfp9\getobj.prg
* you can use HOME() if you wish
RETURN
FUNCTION
getobjX
LOCAL
bb,cc,cStr,cStrX,oldclip
bb
= SYS(1270)
cStr
= bb.name
cStrx
= ""
IF PEMSTATUS
(bb,"Value",5)
cStrx = ".Value"
ENDIF
DO WHILE
.T.
bb = bb.parent
cc=bb.name
IF
bb.baseclass = "Form"
cStr="ThisForm."+cStr
EXIT
ENDIF
cStr = cc+"."+cStr
ENDDO
oldclip
= _Cliptext
_cliptext
= cStr+cStrx
KEYBOARD
'{CTRL+V}'
_Cliptext = oldclip
RETURN
With this simple program loaded to trap the "CTRL+H" key all I have to do is
1. Click in my code window (Command, Screen/Class Code or PRG) to set the insertion point.
2. Hover the mouse over the object on the form I am interested in
3. Press "CTRL+H" to insert the code to that object wherever my insertion point was set to.
So if I had my mouse hovering over the option1. Radio button I would have this inserted into my code window in a flash:
ThisForm
.Container1.Pageframe1.Page1.Optiongroup1.Option1.Value
That is all. Takes a fraction of a second and no searching through lists or even intellisense. How cool is that?
Thanks Rick for an excellent session.
OzFox 2007 Rocked!