Re: [Xswt-developer] event handlers
Brought to you by:
dvorme
|
From: David J. O. <dj...@co...> - 2006-06-22 03:43:52
|
Cool! Dave Orme Hallvard Tr=E6tteberg wrote: >> -----Original Message----- >> Date: Mon, 19 Jun 2006 22:03:46 -0500 >> From: "David J. Orme" <dj...@co...> >> Subject: Re: [Xswt-developer] event handlers >> To: xsw...@li... >> >> So it's basically an elegant way to get closures for Java=20 >> code defined in pnuts, right? >> =20 > > Yes, there's two kinds of script-based listeners that may be attached t= o an > SWT control: > 1) When the value (an IDREF) of an xxxListener attribute refers to a sc= ript > as a whole, the installed proxy looks up the method name and calls that > Function, if it exists. This makes it easy to make a script covering al= l > methods in an interface. > 2) When the value (an IDREF) of an xxxListener attribute refers to a > Function (in a script), the installed proxy calls that Function directl= y, > which only makes sense for single-method interfaces or interfaces where= the > arguments are the same for all methods and the arguments contain enough > information about the event. This is usually the case for GUI event > handlers, which makes it easy to write a long script with functions for > handling all the related controls in a form. This is used in the calcul= ator > example: There's one script for basic math functions (just to test > modularisation), there's one script for the calculator "model" and one = for > the event handlers. > > This technique should work for any scripting language, not just pnuts, = as > long as the script functions may be wrapped in a Function. I.e. the Fun= ction > interface is the bridge and each scripting language should have a > corresponding wrapper, like PnutsFunctionFunction (pnuts' function clas= s is > PnutsFunction, hence the wrapper is called PnutsFunctionFunction instea= d of > just PnutsFunction :-). > > Hallvard > > > > _______________________________________________ > Xswt-developer mailing list > Xsw...@li... > https://lists.sourceforge.net/lists/listinfo/xswt-developer > =20 |