General Component

Fnd_Gen_ButtonText

Fnd_Gen_ButtonText (button; label; alignment{; ->obj1..->objN}) -> Number

Legacy manual page 108

Parameters

ParameterTypeDescription
buttonPointerA pointer to the button
labelTextNew button text
alignmentLongintWhich end to keep stationary
obj1..objNPointerOther form objects to move (optional)
Function resultNumberThe increase in the button size

Description

Sets the button text and resizes the button if necessary. The side passed as the alignment parameter remains stationary, while the other side will be modified if necessary to allow the text to fit. The button will only be enlarged if necessary, never made smaller than its original form size. 4D Constant Type Value Align Left Longint 2 Center Longint 3 Align Right Longint 4

You can optionally pass pointers to other form objects. If the button is resized, these objects will be moved an equal amount so that they maintain an equal distance from the resized button. If you pass Align Left as the alignment, then pass pointers to the objects located directly to the right side of the button (the side that might be moved). The amount of the increase in the button size is returned as the result of this function. This value can be used if you need to procedurally modify aspects of other form objects. For example, imagine we have a Find and Cancel button set located in the lower-right portion of a dialog. If we localize the button text using 4D’s BUTTON TEXT command, the button labels change, but the buttons remain the same size. BUTTON TEXT(bFind;"Rechercher") BUTTON TEXT(bCancel;"Annuler")

By replacing 4D’s BUTTON TEXT command with the Fnd_Gen_ButtonText method, the buttons are now resized to fit the new labels.

Fnd_Gen_ButtonText (->bFind;"Rechercher";Align Right )
Fnd_Gen_ButtonText (->bCancel;"Annuler";Align Right )

However, now the Find button has expanded so that the Cancel button is no longer properly positioned. So we can pass a pointer to the Cancel button to Fnd_Gen_ButtonText when we move the Find button. This tells the Fnd_Gen_ButtonText method to shift the Cancel button so that it retains its original relationship with the Find button.

Fnd_Gen_ButtonText (->bFind;"Rechercher";Align Right ;->bCancel)
Fnd_Gen_ButtonText (->bCancel;"Annuler";Align Right )
Extracted source text
            Fnd_Gen_ButtonText (button; label; alignment{; ->obj1..->objN}) ➔ Number

              Parameter                Type               Description
              button                   Pointer            A pointer to the button
              label                    Text               New button text
              alignment                Longint            Which end to keep stationary
              obj1..objN               Pointer            Other form objects to move (optional)
              Function result          Number             The increase in the button size

            Sets the button text and resizes the button if necessary. The side passed as the alignment parameter
            remains stationary, while the other side will be modified if necessary to allow the text to fit. The button
            will only be enlarged if necessary, never made smaller than its original form size.
              4D Constant              Type               Value
              Align Left               Longint            2
              Center                   Longint            3
              Align Right              Longint            4

            You can optionally pass pointers to other form objects. If the button is resized, these objects will be
            moved an equal amount so that they maintain an equal distance from the resized button. If you pass
            Align Left as the alignment, then pass pointers to the objects located directly to the right side of the
            button (the side that might be moved).
            The amount of the increase in the button size is returned as the result of this function. This value can be
            used if you need to procedurally modify aspects of other form objects.
            For example, imagine we have a Find and Cancel button set located in the lower-right portion of a
            dialog. If we localize the button text using 4D’s BUTTON TEXT command, the button labels change,
            but the buttons remain the same size.
              BUTTON TEXT(bFind;"Rechercher")
              BUTTON TEXT(bCancel;"Annuler")

            By replacing 4D’s BUTTON TEXT command with the Fnd_Gen_ButtonText method, the buttons are
            now resized to fit the new labels.
              Fnd_Gen_ButtonText (->bFind;"Rechercher";Align Right )
              Fnd_Gen_ButtonText (->bCancel;"Annuler";Align Right )

            However, now the Find button has expanded so that the Cancel button is no longer properly positioned.
            So we can pass a pointer to the Cancel button to Fnd_Gen_ButtonText when we move the Find
            button. This tells the Fnd_Gen_ButtonText method to shift the Cancel button so that it retains its
            original relationship with the Find button.
              Fnd_Gen_ButtonText (->bFind;"Rechercher";Align Right ;->bCancel)
              Fnd_Gen_ButtonText (->bCancel;"Annuler";Align Right )