This page is part of a static HTML representation of the TiddlyWiki at https://tiddlywiki.com/

Pragma: \parameters

18 mai 2023 à 14h35

Depuis : 5.3.0 The \parameters pragma is used within procedure and widget definitions to declare the parameters that are expected, and their default values. It is a shortcut syntax for the ParametersWidget.

\parameters (<name>[:<default-value>],<name>[:<default-value>]...)

For example:

\parameters (firstname:"Joe",lastname:"Blogs")

To illustrate the use of \parameters pragma, see Core Icons which are parameterised. The first parameter size specified the size at which the icon should be rendered. For example see the text of $:/core/images/print-button tiddler. The first line defines the size parameter as \parameters (size:"22pt")

{{$:/core/images/print-button|16px}}
<$transclude $tiddler="$:/core/images/print-button" size="32px"/>

Affichera ceci :

In the above example, the first line shows a simple transclusion of $:/core/images/print-button icon with size parameter passed by position and is set to 16px. The second line is a transclusion of image with size parameter passed by name and is set to 32px.