Reusing a Macro which involves a change of color

Navigation:  FAQ > Macros >

Reusing a Macro which involves a change of color

Previous pageReturn to chapter overviewNext page

Suppose you have a simple Macro which tests if the token's date is a holiday, and, if so, shades the textbox containing it in "SG BROWN 470". To make sure that this Macro is reusable, select "Color 2" in the list of colors, instead of a specific color (such as "SG BROWN 470").


Then go in the Grid Options property of the DiaryGridLine and set the value of "Color 2" to the desired color ("SG BROWN 470"in this example).


This seems to be a longer procedure since, the first time, it involves two steps instead of one. However the benefits become apparent as soon as you reuse the Macro. The next time you need to reuse this Macro on another grid, you simply set the value of "Color 2" in the Grid Options, without modifying the Macro. This has 2 advantages


It reduces the number of Macros. This means you spend less time in the Macros Editor, have fewer problems naming separate Macros that basically do the same thing, and minimize the risks of errors when creating different Macros.


It makes it easy for beginner users to reuse Macros; they do not need to modify them, they just set the value of "Color 2" in the Grid Options. Since Macros are usually handled by the Q++Studio Administrator, this frees him/her to concentrate on more complex issues.


This method can also be used for Saras, although Saras are usually more tightly linked to a specific GridTemplate than Macros.

Topic 113045 updated on 03-May-2018.
Topic URL: