[[.taglib as='chat' from='chatbox.spi']]

[[--
  You can and often should put the handlers in a separate file,
  with the class it associates with where applicable.  Here
  We just inline our handler; for an example of the other,
  see the to-do demo.
--]]
[[!
  def __init__(self):
    self.boxed = False

  def boxaction(self, api, one=True):
    self.boxed = True
]]

[[\
  import spyceUtil 
  # tell the parent template we want a link to the chatbox source
  L = [('chatbox active tag', spyceUtil.url2file('chatbox.spi', request.filename()))]
]]
<spy:parent title="Active tag demo" extracode="=L" />

<table border=1 cellpadding=10>
<tr>
  <f:form>
    <td valign=top>
      First active tag instance: 3 lines max, declares handler outside of the tag.
	  <br>Only this one will cause an extra handler to fire:
	  <chat:boxlet handler="self.boxaction" lines=3 />
	  <p>
	  [[ if self.boxed:{ ]]
	  <b>Extra handler fired</b>
	  [[ } ]]
    </td>
  </f:form>

  <f:form>
    <td valign=top>
	  2nd boxlet instance.  This one uses default settings (5 lines, no external handlers)
	  <chat:boxlet />
    </td>
  </f:form>
</tr>
</table>

The last line in chat is: [[=last ]]