Skip to main content
Version: 20 R7 BETA

SET MACRO PARAMETER

SET MACRO PARAMETER ( selector ; textParam )

ParameterTypeDescription
selectorIntegerSelection to use
textParamTextText sent

This command is not thread-safe, it cannot be used in preemptive code.

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 textInteger1
Highlighted method textInteger2

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:

<macro name="MyMacro" version="2">
--- Text of macro ---
</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