Toolbar Component

Fnd_Tlbr_Button_Menu

Fnd_Tlbr_Button_Menu (button name; ->menu items)

Legacy manual page 247

Parameters

ParameterTypeDescription
button nameTextThe button name
menu itemsPointerText array of menu items

Description

Use this command to turn a toolbar button into a drop-down menu. First create the menu using the Fnd_Tlbr_Button_Add method. Then create a text array of menu items and call Fnd_Tlbr_Button_Menu.

$method_t:="PrintRoutine(<FndMenuNumber>)"
Fnd_Tlbr_Button_Add ("PrintBttn";"Print");"Fnd_Bttn_Printer";$method_t)

ARRAY TEXT(PrintOptions_at;4)

PrintOptions_at{1}:="Sales Report"
PrintOptions_at{2}:="-" ` Add a divider line.
PrintOptions_at{3}:="Report Editor"
PrintOptions_at{4}:="Label Editor"
Fnd_Tlbr_Button_Menu ("PrintBttn";->PrintOptions_at)

You will need to use a process array with 4D 2003. A local array can be used with 4D 2004. The array can be cleared immediately after the call. In the example above, “<FndMenuNumber>” will be replaced with the selected menu item number, then the entire value of the $method_t variable will be executed. So if the Report Editor menu item is selected, the PrintRoutine method will be passed a value of 3 as the first parameter. Then, in the PrintRoutine method, we should use a compiler directive to indicate that the first parameter is a number:

` Project Method: PrintRoutine (menu item)

C_LONGINT($1;$selectedMenuItem_i)

$selectedMenuItem_i:=$1

...

The following strings are automatically replaced at runtime with the appropriate values: String Value <FndButtonName> The name of the button <FndButtonLabel> The button's label <FndMenuNumber> The selected menu item number <FndMenuLabel> The selected menu item label

Note that when using the name or label strings, you will need to include the quotation marks to pass the value as a text value to your button method. This is easily done using the \" escape sequence. For example:

$method_t:="PrintRoutine(\"<FndMenuLabel>\")"
Fnd_Tlbr_Button_Add ("PrintBttn";"Print");"Fnd_Bttn_Printer";$method_t)

You can pass any combination of these values and other values to your button method. The “<FndButtonName>” and “<FndButtonLabel>” strings can be used for any toolbar button style. The “<FndMenuNumber>” and “<FndMenuLabel>” strings will be converted only for menu buttons.

Extracted source text
            Fnd_Tlbr_Button_Menu (button name; ->menu items)

              Parameter                Type                    Description
              button name              Text                    The button name
              menu items               Pointer                 Text array of menu items

            Use this command to turn a toolbar button into a drop-down menu. First create the menu
            using the Fnd_Tlbr_Button_Add method. Then create a text array of menu items and call
            Fnd_Tlbr_Button_Menu.
              $method_t:="PrintRoutine(<FndMenuNumber>)"
              Fnd_Tlbr_Button_Add ("PrintBttn";"Print");"Fnd_Bttn_Printer";$method_t)
              ARRAY TEXT(PrintOptions_at;4)
              PrintOptions_at{1}:="Sales Report"
              PrintOptions_at{2}:="-" ` Add a divider line.
              PrintOptions_at{3}:="Report Editor"
              PrintOptions_at{4}:="Label Editor"
              Fnd_Tlbr_Button_Menu ("PrintBttn";->PrintOptions_at)

            You will need to use a process array with 4D 2003. A local array can be used with 4D 2004. The array can
            be cleared immediately after the call.
            In the example above, “<FndMenuNumber>” will be replaced with the selected menu item number, then
            the entire value of the $method_t variable will be executed. So if the Report Editor menu item is selected,
            the PrintRoutine method will be passed a value of 3 as the first parameter.
            Then, in the PrintRoutine method, we should use a compiler directive to indicate that the first
            parameter is a number:
                ` Project Method: PrintRoutine (menu item)
              C_LONGINT($1;$selectedMenuItem_i)
              $selectedMenuItem_i:=$1
              ...

            The following strings are automatically replaced at runtime with the appropriate values:
              String                          Value
              <FndButtonName>                 The name of the button
              <FndButtonLabel>               The button's label
              <FndMenuNumber>                The selected menu item number
              <FndMenuLabel>                 The selected menu item label

            Note that when using the name or label strings, you will need to include the quotation marks to pass
            the value as a text value to your button method. This is easily done using the \" escape sequence. For
            example:
              $method_t:="PrintRoutine(\"<FndMenuLabel>\")"
              Fnd_Tlbr_Button_Add ("PrintBttn";"Print");"Fnd_Bttn_Printer";$method_t)

            You can pass any combination of these values and other values to your button method.
            The “<FndButtonName>” and “<FndButtonLabel>” strings can be used for any toolbar button style. The
            “<FndMenuNumber>” and “<FndMenuLabel>” strings will be converted only for menu buttons.