I think you missed my meaning. I'm familiar with the capabilities described in the blog post. What I'm looking to do is to be able to modify EXISTING internal views in the instantiation, whereas currently you can only add new views. If you look at the example again, I'm trying to attach a new event to an existing internal view. This allows better code reuse, e.g. a generalized form with customizeable submit actions, etc. Possible syntaxes for this new capability are shown below:
<class name="foo">
<view name="a" />
<button name="b">
<view name="c" />
</button>
</class>
<!-- new event selection syntax using a _javascript_ _expression_ under the class context -->
<foo>
<method event='this.b.onclick'>
//some code
</method>
</foo>
<!-- full modification of previously defined attributes and internals -->
<foo>
<modify name="a" bgcolor="somecolor" />
<modify name="b.c">
<view "d" />
</modify>
</foo>
As alluded to in my previous post, you can achieve these same goals using _javascript_ (in the oninit event, not the onconstruct like I used in the example, because internal views need to have already been constructed to be referenced), but the syntax is ugly and it requires too deep a knowledge of lazlo for the average user.
-Dave
-----Original Message-----
From: P T Withington [mailto:[EMAIL PROTECTED]]
Sent: Sat 9/16/2006 9:12 AM
To: Hogarty, David A.
Cc: Not Zippy; James Howe; [email protected]
Subject: Re: [Laszlo-user] Code Refactoring?
On 2006-09-15, at 17:39 EDT, Hogarty, David A. wrote:
> On this same note, I think it would be beneficial to allow post-
> definition modification of a classes internal views at
> instantiation, for example:
>
> <class name="foo">
> <view name="a" />
> <button name="b" />
> </class>
>
>
> <foo>
> <method event='this.b.onclick'>
> //some code
> </method>
> </foo>
>
>
> Can we already do something like this?
Yes. See this nifty blog entry of Oliver's on [instance-first
development](http://osteele.com/archives/2004/03/classes-and-
prototypes).
_______________________________________________ Laszlo-user mailing list [email protected] http://www.openlaszlo.org/mailman/listinfo/laszlo-user
