Glimmr Graphic Hyperlinks

version 1/100805 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next

  • Section: Basic usage

    In order to use graphic hyperlinks in a window, we must identify that window as receptive to links. This is as simple as writing:

        The graphics-window is g-graphlinked.

    Alternatively, we can define our window as of the kind "graphlink g-window". This will automatically set the g-graphlinked property:

        The graphics-window is a graphlink g-window.

    Note that Glimmr Graphic Hyperlinks only works with graphics windows. A text hyperlinking solution, such as Inline Hyperlinks or the system built into Flexible Windows, is needed for text windows.

    The list of rectangular areas that are to be hyperlinked, regardless of how many windows are represented, are stored in a single table, the Table of Graphlink Glulx Replacement Commands. These hotlinked rectangular zones are called graphic hyperlinks or "graphlinks," and they can be identified in one of two ways: If we are using Glimmr Canvas-Based Drawing (GCBD), they are identified with the name of an object (usually a g-element); if we are not, we identify them using a text. While manually interacting with the graphlink list is rarely required in GCBD, it is a must for any other project. We add a link to the table using the phrase:

        set a graphlink in the graphics-window identified as "undo button" from 0 by 0 to 10 by 10 as "Undo"

    This adds a graphlink called "undo button" to the Table of Graphlink Glulx Replacement Commands. When the link is clicked it will--if we use the default rules--enter "Undo" on the command line on behalf of the player. Note the string of coordinates, which are entered LEFT by UPPER to RIGHT by LOWER.

    There are two phrases that can be used to remove links from the table. To clear a single link:

        clear the graphlink identified as "undo button"

    Or we can clear the whole table at once with:

        zero the link-table

    Note that the graphlink identifier we use should--at least generally--be unique. This is simply because a request to clear a graphlink would otherwise be ambiguous (the clear command only clears the first graphlink it encounters). By default, the "set a graphlink" phrase will not allow us to have more than one row in the table with the same identifier. If we set a second graphlink using an identify that is already in the table, the original will be overwritten. To avoid this, add the "ignoring redundant links" phrase option:

        set a graphlink in the graphics-window identified as "undo button" from 0 by 0 to 10 by 10 as "Undo", ignoring redundant links.

    The Table of Graphlink Glulx Replacement Commands starts with 120 entries, which is likely to be sufficient for nearly all purposes. We can expand the table if need be, of course. To add another 50 rows, for example:

        Table of Graphlink Glulx Replacement Commands (continued)
      linkid  g-win  p-top  p-bottom  p-left  p-right  replacement  alt  action  
      with 50 blank rows