9.1From Anchors to Callbacks
You can generate run-of-the-mill HTML anchors by creating an anchor brush (send WAHtmlCanvas>>anchor
to the canvas), then configuring the anchor to be associated with a URL using WAAnchorTag>>url:
and specifying the text for the anchor using WAAnchorTag>>with:
. Here is a simple component that displays an anchor that displays a link to the Seaside web site.
WAComponent subclass: #SimpleAnchor
instanceVariableNames: ''
classVariableNames: ''
poolDictionaries: ''
category: 'SeasideBook-Anchors'
SimpleAnchor>>renderContentOn: html
html anchor
url: 'http://www.seaside.st';
with: 'Seaside Website'
Register this component as “simple-anchor” then view the component through your browser and you should see a page similar to Figure 68.
Clicking on the Seaside Website anchor will bring you to the website.