Condividi tramite


Manipulating Objects

There are several ways you can manipulate objects at design time:

  • Set the size and position of objects by dragging them in the Form Designer window.
  • Align controls by choosing alignment tools on the Layout toolbar or options on the Format menu.
  • Set colors by choosing foreground and background colors in the Palette toolbar.
  • Set properties in the Properties window. The primary point of control for all objects in your form is the Properties window.

Setting Properties at Design Time

The Properties window opens with the properties or events of the selected object displayed. If more than one object is selected, the properties that the objects have in common are displayed in the Properties window. To edit the properties or events of a different object, choose the appropriate object from the Object box or select a different control in the form.

The Properties window

To set a property

  1. In the Properties window, select a property in the Property and Events list.

  2. In the Property Settings box, type or choose the desired setting for the selected property.

    Note   Properties that are read-only at design time, such as the Class property of an object, are displayed in the Properties and Events list in the Properties window in italics.

If the property requires a character value, you don't have to include the value in quotation marks. If you want the caption of a form to be CUSTOMER, type CUSTOMER in the Property Settings box. If you want the caption of a form to be "CUSTOMER," with the quotation marks displayed in the window title, type "CUSTOMER" in the Property Settings box.

Setting Properties with Expressions

You can also set properties to the results of expressions or functions through the Properties window.

To set a property with an expression

  • In the Properties window, choose the Function button to open the Expression Builder.

    -or-

  • In the Property Settings box, type = followed by an expression.

    For example, you can set the Caption property of a form to indicate the currently active table when the form is run by typing =ALIAS( ) in the Property Settings box.

A property expression is evaluated when you set it in the Properties window and when the object is initialized at run time or design time. Once the object is created, the property setting doesn't change until you or a user explicitly changes it.

Caution   If you set a property to the result of a user-defined function, the function is evaluated when you set the property or modify or run the form. If there is an error in the user-defined function, you might not be able to open your form. You can also set the property to the user-defined function in the Init event of the object, as in the following example: THIS.Caption = myfunction( )

If there is an error in the user-defined function, you still won't be able to run the form this way, but you'll be able to modify it.

See Also

Adding Properties and Methods to a Form | Defining Form Behavior | Creating Forms | Editing Event and Method Code | Form Designer