Form design shortcut

I’ve been very busy creating content for our developer conference and we’ve been working hard on our product because we’re close to shipping.

While preparing a demo form, I came across a shortcut for designing a form that I thought I’d share.

I wanted to add controls to a form thinking about their function first. I’d add a textbox, change my mind to make it a listbox, add other controls, etc. After the form was functioning as I’d liked, I would spend time making them pretty. For example, I wanted to make them all the same font size.

Of course, in a developer’s environment, you’d use a class library rather than VFP native controls. This allows you to just change the baseclass properties and all controls that inherit from them would be automatically changed. However, you may not want to change each baseclass, or you may just want to override the properties for a single instance of a form.

Of course you can multi-select form controls and then change a common property in the property sheet, but that doesn’t necessarily get all the controls. For example, some control’s may not have a particular property, and thus won’t show up in a multi-selection in the property sheet..

Just two lines of code in the command window can set all the objects that have a FontSize property:

ASELOBJ(aArray,1)

aArray[1].Setall("FontSize",12)

The ASELOBJ gets an object reference to the form designer. The SetAll method sets a property to a specified value for a container’s objects.

37888