#### 9.7.5.4 Building an ALink button object from an ALink keyword list

When it comes time to output an ALink button for a topic, the following macro is invoked to process list variable $$AlinkKeys (see §9.7.5.1 Creating a list of ALink keywords from paragraphs or §9.7.5.2 Creating a list of ALink keywords from markers) and add each keyword to the button object:

[ALinkButton]

<$_if (Nkeys > 0)>

<$ALinkButtonStart><$$ALinkParamNum=1>\

<$_repeat ($$Nkeys)>\

<$$ALinkParamText=$$ALinkKeys[$$ALinkParamNum]>\

<$$ALinkParamNum++><$ALinkButtonParam>\

<$_endrepeat>\

<$ALinkButtonEnd><$$Nkeys=0>\

<$_endif>

[AlinkButton] uses two additional macro variables:

$$ALinkParamNum | Keyword parameter counter (the N in "Item N")
$$ALinkParamText | Text of a keyword.

$$ALinkParamNum is initialized to 1, and then incremented before each keyword parameter is added to the button object, because the "Item N" keyword parameters for the button object start with N=2, not N=1 (see §9.7.4 Rolling your own macros for ALink jumps in HTML Help).

[AlinkButton] invokes three other macros to build the button object:

Start of button object: [ALinkButtonStart]

Keyword parameters: [ALinkButtonParam]

End of button object: [ALinkButtonEnd]

Start of button object

The first part of the ALink button object is straightforward, and uses the same code described in §9.7.4 Rolling your own macros for ALink jumps in HTML Help:

[ALinkButtonStart]

<object id="hhctrl" type="application/x-oleobject"

classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"

width="100" height="100">

<param name="Command" value="ALink">

<param name="Button" value="Text:Related topics">

<param name="Flags" value="1">

<param name="Item1" value="">

Keyword parameters

Next come the "Item2" through "Item N" parameters, which are added to the button object one by one, as list variable $$AlinkKeys is processed:

[ALinkButtonParam]

<param name="Item<$$ALinkParamNum>" value="<$$ALinkParamText>">

End of button object

The last piece ends the button object:

[ALinkButtonEnd]

</object>

This version of the [AlinkButton] macro assumes that each item in the $$ALinkKeys list contains a single ALink keyword. To process a list that contains multiple keywords per list item, you would need a slightly more complex version; see §9.7.5.6 Including multiple ALink keywords in a paragraph or marker.

See also:

§9.7.5.5 Positioning the ALink button in each HTML Help topic

| 9.7.5.3 Initializing the ALink keyword list counter |  | 9.7.5.5 Positioning the ALink button in each HTML Help topic |