Built-in macros: $prototyper

The $prototyper macro is replaced by a boolean literal true or false, depending on whether the current code is compiled for the prototyping environment or not.

Content

true

false

Discussion

If the macro results in the value true, the code is compiled for the execution within the Canvas area of the Composer or for the execution within the Prototyper window. If the macro results in the value false, the code is compiled for the target system.

This macro can be evaluated within Chora expressions or you can use it to conditionally compile the application. For example, if you want a view to appear with a different color in the target system only, you can implement following code in the Init() method of your component:

$if !$prototyper SomeView.Color = #FF0000FF; $endif

This color alternation will affect the appearance of the view in the code generated for the target system only. When editing the GUI component in the Composer window of when testing the application in the Prototyper window, it has no effect. Similarly the macro $prototyper can be used inside a regular Chora expression wherever a boolean operand is allowed. For example, you can set a property of an object to the value true or false depending on whether the code is executed in Composer/Prototyper or generated for the target system:

SomeObject.SomeProperty = $prototyper;