[Seaside] Re: Re: Re: SUPeriodical - changing the frequency on the fly

Lukas Renggli renggli at gmail.com
Thu Aug 24 16:56:56 UTC 2006


> Is there any way to do what I want using Scriptaclous?

Sure, try something like this:

	html div
		id: 'time';
		script: (html periodical
			frequency: frequency;
			callback: [ :r | r render: Time now ];
			assignTo: 'updater');
		with: Time now.

	html div id: 'track'; with: [ html div id: 'handle' ].
	html script: (html slider
		handleId: 'handle';
		trackId: 'track';
		value: frequency;
		range: (1 to: 10);
		onChange: (SUStream on: 'console.log("change",
arguments);updater.stop();updater.frequency=arguments[0];
updater.start();'))

The last part is slightly ugly as I wrote some bare JavaScript. You
could archive exactly the same by composing a script like:

html javascript
     add: (html periodical
         alias: 'periodical';
         stop):
     add: (html periodical
         ....

but this gets too cumbersome in my opinion. I usually suggest that you
write more complicated functionality in bare JavaScript (use #script
or a class extension to SULibrary) and call it from your code using
simple configurable objects. This scales usually much better.

Lukas

-- 
Lukas Renggli
http://www.lukas-renggli.ch


More information about the Seaside mailing list