##### 18.7.5.3 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 §18.7.5.1 Creating a list of ALink keywords from paragraphs) 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 "ItemN")
$$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 "ItemN" keyword parameters for the button object start with N=2, not N=1 (see §18.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 §18.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 "ItemN" 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 §18.7.5.5 Including multiple ALink keywords in a paragraph or marker.

See also:

§18.7.5.4 Positioning the ALink button in each HTML Help topic

Previous Topic: 18.7.5.2 Initializing the ALink keyword list counter

Next Topic: 18.7.5.4 Positioning the ALink button in each HTML Help topic

Parent Topic: 18.7.5 Using the same format for ALink keywords and jumps

Sibling Topics:

18.7.5.1 Creating a list of ALink keywords from paragraphs

18.7.5.2 Initializing the ALink keyword list counter

18.7.5.4 Positioning the ALink button in each HTML Help topic

18.7.5.5 Including multiple ALink keywords in a paragraph or marker

Table of Contents • Index