Welcome to MSDN Blogs Sign in | Join | Help

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

 

Published Sunday, September 26, 2004 9:27 AM by Calvin_Hsia
Filed under:

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Form design shortcut

Thursday, September 04, 2008 5:39 AM by designabovo.com

<a href= http://designabovo.com >Дизайн малогабаритных квартир</a>

Leave a Comment

(required) 
required 
(required) 
 
Page view tracker