Localization Component
Fnd_Loc_FixLabelWidths
Fnd_Loc_FixLabelWidths (->form object; ->enterable object{; ..repeat..})
Parameters
| Parameter | Type | Description |
|---|---|---|
| $1, $3, $5..$N | Pointer | The label to adjust |
| $2, $4, $6..$N+1 | Pointer | The field to its right |
Description
One of the problems with localizing field labels is that if you make the label large enough for one language, it may appear too large for other languages. And even if you resize the label object, you must also reposition the field next to it. However, if you do this for each label/field combination individually, you will end up with fields that are no longer aligned. One solution is to use multiple pages or multiple forms — one for each language. But this can be a maintenance problem for complex layouts. Another solution is to use the Fnd_Loc_FixLabelWidths method to resize multiple labels and fields in a single call. Pointers to 4D form objects are passed to this routine in sets of two. One for the label, and one for the field. This routine will move the right side of the label so that the entire label text fits. It will then adjust the left side of the field the same amount, so that the space between the label and the field remains unchanged. If multiple sets of label and field pointers are passed, the widest label is used for adjusting all of the objects. For example, imagine we have this English set of fields on a form: We start by replacing the static text labels with variables, so we can pass pointers to these objects to the Fnd_Loc_FixLabelWidths method. Then we localize the labels using Foundation’s Fnd_Loc_GetString function. Now the labels are correct, but the colon has been truncated on some of the labels. So we pass the three labels on the left, along with their associated fields, to the Fnd_Loc_FixLabelWidths method in a single call:
Fnd_Loc_FixLabelWidths (->vNumberLabel;->[Products]Number;
->vNameLabel;->[Products]Name;->vDescLabel;->[Products]Desc)
Now the labels on the left are properly displayed. The width of the label objects has been increased slightly, and the width of the corresponding fields has been reduced by the same amount. The amount of the change is based on the content of the labels. Now we just need to apply the fix to the List Price label and field:
Fnd_Loc_FixLabelWidths (->vPriceLabel;->[Products]ListPrice)
See the Product Sales example database to see this command in action.
Extracted source text
Fnd_Loc_FixLabelWidths (->form object; ->enterable object{; ..repeat..})
Parameter Type Description
$1, $3, $5..$N Pointer The label to adjust
$2, $4, $6..$N+1 Pointer The field to its right
One of the problems with localizing field labels is that if you make the label large enough for one
language, it may appear too large for other languages. And even if you resize the label object, you must
also reposition the field next to it. However, if you do this for each label/field combination individually,
you will end up with fields that are no longer aligned.
One solution is to use multiple pages or multiple forms — one for each language. But this can be a
maintenance problem for complex layouts. Another solution is to use the Fnd_Loc_FixLabelWidths
method to resize multiple labels and fields in a single call.
Pointers to 4D form objects are passed to this routine in sets of two. One for the label, and one for the
field. This routine will move the right side of the label so that the entire label text fits. It will then adjust
the left side of the field the same amount, so that the space between the label and the field remains
unchanged.
If multiple sets of label and field pointers are passed, the widest label is used for adjusting all of the
objects.
For example, imagine we have this English set of fields on a form:
We start by replacing the static text labels with variables, so we can pass pointers to these objects
to the Fnd_Loc_FixLabelWidths method. Then we localize the labels using Foundation’s
Fnd_Loc_GetString function.
Now the labels are correct, but the colon has been truncated on some of the labels. So we pass the three
labels on the left, along with their associated fields, to the Fnd_Loc_FixLabelWidths method in a single
call:
Fnd_Loc_FixLabelWidths (->vNumberLabel;->[Products]Number;
->vNameLabel;->[Products]Name;->vDescLabel;->[Products]Desc)
Now the labels on the left are properly displayed. The width of the label objects has been increased
slightly, and the width of the corresponding fields has been reduced by the same amount. The amount of
the change is based on the content of the labels.
Now we just need to apply the fix to the List Price label and field:
Fnd_Loc_FixLabelWidths (->vPriceLabel;->[Products]ListPrice)
See the Product Sales example database to see this command in action.