Setting Control Border Links snappings

What is snapping?
Setting Manual Snaps
Setting Simple Border Snapping
Setting Complex Border Snapping
Automated border linking
Checking Snaps

A Snapping means that the position of a control's borders depends on the position of the form's borders. A control border can be linked to the border or the center of a form, or to the border or the center of another control.

You can set these relationships at the form creation stage for each control or a selected group of controls. Controls of all types can be snapped.

There are two snapping types: manual (simple and complex control border snapping) and automatic snapping (auto-snap).

In manual snap mode, the user sets all snaps manually. In auto-snap mode, snapping depends on the type of control.

To master snapping techniques you should create a sample form and populate it with some controls of the required type. You should also turn on the snap viewing mode (select Form - Show Snaps). As you master snapping techniques, you will be able use them to determine control behavior in particular forms.

Manual snap

You can perform simplified Manual snap by selecting a snap strategy for each control (control the element's behavior if the form is resized) and setting snaps for each border of the control individually.

Use the Snap control borders window to configure snaps. You can open this window from Set rule of the Snap borders property in the Position category.

You can set links for a group of selected controls.

Simple Border Snapping

You can set snaps using the Simple tab.

Properties in the Snap Horizontally window are used to set control behavior if the horizontal size of the form changes.

Properties in the Snap vertically window are used to set control behavior if the vertical size of the form changes.

The procedure for setting snaps in these groups is the same.

With a simple snap, a control can be snapped to the form, a toolbar, or a Separator type control.

The Snap type property specifies the snapping method:

  • Left: a control is snapped to the left border of an area (the whole control moves with the left border of the area);
  • Right: a control is snapped to the right border of an area (the whole control moves with the right border of an area);
  • Resize: The right border of the control moves to the right border of the area (when the horizontal size of the area changes, the right border of the control moves with the right border of the area, and the distance between borders remains constant);
  • Proportional: the right border of a control is snapped to the right border of an area so that when the area is resized, the proportion between the distance from the right border of a control to the left and the right borders of the area remain constant. The same is true for the left border of a control.
  • Center: the left and right borders of a control are snapped to the center of an area, the center of the form, or the center of a control.

In all cases, except for the proportional snap, the control is snapped strictly. In this case the item boundaries do not change position with respect to the snapped border.

The control's behavior for changes in vertical dimensions of the form is set in the same way.

The Manual snap property of the Snap control borders window is used to block the auto-snapping engine.

To remove all snappings, click the Reset all snappings button.

Complex Border Snapping

You can set up snaps using the Complex tab. The tab contains four property groups in frames. Each group is responsible for snapping one border of a control. The group frame title corresponds to the name of the linked control border (e.g. the Left border group is responsible for snapping the left border of the control). The snap configuration procedure is the same for all groups, so we will describe the setting of snaps for one border only.

The Snap to: attributes perform the primary linkage. You have to select an object to which the border is snapped and to specify the border of the object to which the control will be snapped. From the list of borders, select a border to which the control will be snapped. The list of objects includes all controls on the current page of the form. Including the snapped control itself which can be selected to snap one border to another. You should do this if you need to set snaps that do not resize the control (except for snapping to the center), but the control can be snapped to other controls in the area. If you will need to resnap a control to another control you'll just have to change the snap of one border.

The Keep proportions to: attribute performs the secondary linkage.

To remove all snappings, click the Reset all snappings button.

Automated border linking

Automated border linking is a property of a form or a toolbar that snaps controls to borders automatically. If this property is set, each control (with a few exceptions) in a form will be snapped to the form or to other controls using a special algorithm that applies automatically.

Automated snaps may not produce the desired result, so sometimes the auto-linking strategy has to be changed manually.

You can cancel autosnap mode. If controls have to track form size changes while the autosnap mode is disabled, the form developer must set the snaps manually.

If the autosnap borders property is reset programmatically, all form controls that do not use the Manual snap mode will be snapped automatically. If a control was snapped prior to resetting, but the Manual snap option was not set, the snaps for the control will be changed as well.

Each new control will be automatically snapped to the form borders. When the control is moved, its snaps will move, too.

To set automatic linking of borders, set the Snap borders automatically property.

Important! The snaps that are set with the Snap borders automatically property cannot be removed by selecting Edit - Undo item.

Checking Snaps

You can view snaps by enabling Form - Show Snaps.

To check snapping behavior, use the Form - Test mode. Use the mouse to change the form's size and track the behavior of controls.

1C:Enterprise Developer's Community