Friday, March 17, 2006

FoxPro Tips: Toolbox

The Toolbox is a very powerful tool added to VFP 8 and improved in VFP 9 by the simple fact it can be docked. Several developers refer to the Toolbox as the Forms Control toolbar on steroids (which might not be as politically correct as it once was {g}). I like the Toolbox for several reasons, but the one I really like is working with ActiveX controls.

You can drag and drop ActiveX controls from the Toolbox to the Form or Class Designer. Handy in itself, but not where I think the real power is. I like dropping the ActiveX control in a program or method window. Dragging the ActiveX controls to an editor provides the needed NEWOBJECT() code. The following code was created when I dropped the DynaZip Zip ActiveX control in the editor:

Olecontrol = NEWOBJECT("dzactxctrl.dzactxctrl.1", "dzactx.dll")

Now you do not have to look up the registration information for the control in the Windows Registry or the documentation distributed with the control. You can change the line of code to:

LOCAL loZip AS "dzactxctrl.dzactxctrl.1"

Now as soon as you type loZip. in the editor you get IntelliSense for the ActiveX control. This works well and really increases productivity when you do some Automation code with a control of this type.

1 Comments:

At 3/27/2006 05:05:00 PM, Anonymous Tamar E. Granor said...

I usually refer to the Toolbox as having the ease of use of the Form Controls toolbar (actually, it's easier) and the power and flexibility of the Component Gallery. To me, it's what the CG should have been.

 

Post a Comment

<< Home