Skip to main content
Version: Next

SET MACRO PARAMETER

SET MACRO PARAMETER ( selector ; textParam )

ParameterTypeDescription
selectorLongint🡒Selection to use
textParamText🡒Text sent

Description

The SET MACRO PARAMETER command inserts the paramText text into the method from which it has been called.

If text has been selected in the method, the selector parameter can be used to set whether the paramText text must replace all of the method text or only the selected text. In selector, you can pass one of the following constants, added to the “4D Environment” theme:

ConstantTypeValue
Full method textLongint1
Highlighted method textLongint2

If no text has been selected, paramText is inserted into the method.

Note

In order for the GET MACRO PARAMETER and SET MACRO PARAMETER commands to work correctly, the new “version” attribute must be declared in the macro itself. The “version” attribute must be declared as follows:

--- Text of macro ---

Example

This macro builds a new text that will be returned to the calling method:

 var $input_text : Text
 var $output_text : Text
 GET MACRO PARAMETER(Highlighted method text;$input_text)
  //Suppose that the selected text is a table, i.e. “[Customers]”
 $output_text:=""
 $output_text:=$output_text+Command name(47)+"("+$input_text+")" // Select all ([Customers])
 $output_text:=$output_text+"$i:="+Command name(76)+"("+$input_text+")" // $i:=Records in selection([Customers])
 SET MACRO PARAMETER(Highlighted method text;$output_text)
  //Replaces the selected text by the new code

See also

GET MACRO PARAMETER