I'd like to be able to write rollover effects more declaratively. For example, instead of writing something like this: <view bgcolor="red" onmouseover="this.bgcolor=blue" onmouseout="this.bgcolor=red"/>
I'd like to be able to use a constraint:
  <view bgcolor="${this.mouseisover ? blue : red}"/>

Or more realistically, for a view that has a more radically different appearance in its rollover and non-rollover states, I'd like to be able to do something like this:
  <view>
    <state apply="${!this.mouseisover}">
      ...normal state...
    </state>
    <state apply="${this.mouseisover}">
      ....rollover state...
    </state>
  </view>

I can get this if I add these lines to LzModeManager.handleMouseEvent:
if (eventStr == "onmouseover") view.setAttribute('mouseisover', true); if (eventStr == "onmouseout") view.setAttribute('mouseisover', false); if (eventStr == "onmousedown") view.setAttribute('mouseisdown', true); if (eventStr == "onmouseup") view.setAttribute('mouseisup', false);

Does this sound reasonable? I don't want to write a performance test to see if this is credible, so I thought I'd run it by your intuition instead.

---

Notes:

LzView.mouseover would be a better name for this, but for the constraint system to work, onmouseover would have to be sent when it changed its value from true to false, which would be an incompatible (and confusing) change.

LzView.mouse.over and LzView.mouse.down would also be more elegant names than LzView.mouseover and LzView.mousedown, but this would require an extra node for each view, to register the delegates on, and I was worried about the effect on memory footprint and instantiation time if I added an extra Object to every LzView.
_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to