4D v16.3

SET MACRO PARAMETER

Home

 
4D v16.3
SET MACRO PARAMETER

SET MACRO PARAMETER 


 

SET MACRO PARAMETER ( selector ; textParam ) 
Parameter Type   Description
selector  Longint in Selection to use
textParam  Text in Text sent

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:

Constant Type Value
Full method text Longint 1
Highlighted method text Longint 2

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:

 C_TEXT($input_text)
 C_TEXT($output_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

 
PROPERTIES 

Product: 4D
Theme: Tools
Number: 998

 
HISTORY 

Created: 4D v11 SQL

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)