Clicking events in with-Style
Return to home page
Comments Loading...
2003-10-05

The other day I was responding to questions about firing off actions using with:Style. One of the things I said was that you could not yet use the <script language="smalltalk"> logic. Well, that has now changed. It didn't take much work, but the current development version of with:Style now supports scripts being fired by XML-Events. This looks roughly like this:

<html
	xmlns="http://www.w3.org/2002/06/xhtml2"
	xmlns:ev="http://www.w3.org/2001/xml-events">
	<head>
		<script id="helloworld" language="Smalltalk">
			| temporaryVariable |
			temporaryVariable := (this wsAttributeAt: ''message'') value.
			Dialog warn: temporaryVariable.
		</script>
	</head>
	<body>
		<span ev:type="click" ev:handler="#helloworld" message="Hello!">Click me</span>
	</body>
</html>

Take note of the 'this' variable. That this gives you access to the node that spawned the event! :)