Author Topic: Eventhandling for Elements  (Read 1725 times)

Domenico

  • Newbie
  • *
  • Posts: 16
Eventhandling for Elements
« on: December 11, 2009, 09:24:06 pm »
It would be very nice if it were possible to define behaviors for particularly events directly in the asul definition.

For example:

Code: [Select]
<button anchors="82,3,pw,ph" width="16" height="16" name="samplebutton" style="something">
<box name="$up$"/>
<box name="$over$" style="over"/>
<box name="$down$" style="down"/>
<Scripts>
<OnLoad>megazine.DoSomething_OnLoad(this);</OnLoad>
<OnLeave>megazine.DoSomething_OnLeave(this);</OnLeave>
<OnMouseOver>megazine.DoSomething_OnMouseDown(this);</OnMouseOver>
<OnMouseDown>megazine.DoSomething_OnMouseDown(this);</OnMouseDown>
<OnMouseUp>megazine.DoSomething_OnMouseUp(this);</OnMouseUp>
</Scripts>
</button>
Here I've used the Button as Example but the logic could be used for every element, boxes, frames and so on.

I know that this suggestion would break the separation of (interface and code) but in the other hand it would ease up a lot of things and raise the flexibility of plugin development.

I've tested it with this simple example on a local branch with the latest revision and as3eval http://eval.hurlant.com/ and http://www.riaone.com/products/deval/index.html (native as3 and flex) both works very well.

Plugins could be developed more globally by the translocation of particular logic or functionscalls to the asul. Less variants of practicaly same compiled plugins could be the result and the maintenance of the plugins core functionality would be easier without the heavy load to cover every single custom possibility that maybe someone is needing.

If someone need a custom button, lets say a "Download" Button in the Navigation Bat for example, a <button ...>...<scripts><OnClick>MygetUrl("pathtopdf.pdf", "_blank");</OnClick>... in the Navigation.asul would be your friend. Done. No canges to the Code, no compile and no extra plugin to take care of. :) 

Sure, all this needs more rethinking and should have reasonable borders. I mean, it has to be somehow granted (iterfaces??) that only particular and simple things can be done throu the <script> Block to prevent Chaos. :)
« Last Edit: December 12, 2009, 12:23:23 am by Domenico »

Domenico

  • Newbie
  • *
  • Posts: 16
Re: Eventhandling for Elements
« Reply #1 on: December 11, 2009, 09:59:03 pm »
Update:
I would love to see that megazine will follow a complete event driven architecure in the future. The events that are implemented now are a good start but I think that they need more love and completion to be usefull as they could be.

The sequence model, as i can see is partly implemented already, but not continuous:

Event Generator = Every single element as the event sources should fire up his unique ID, state +plus his additional values.
Event Channel = The megazine API
Event Processing Engine = The event manager
Event-driven activity = Handler in plugins or core catch the events.

« Last Edit: December 11, 2009, 10:58:17 pm by Domenico »