3.2.0

Trying to integrate overlib

I'm trying to integrate the excellent overlib package ( http://www.bosrup.com/web/overlib/ ) into the grid so I can display arbitrary data in a popup when the mouse goes over a specific item.
I can get the mouseover event handling to work fine, however I need to know which row I'm over so I can display the right popup data. What is the best way to do this?

I've looked at the dispatch() method in html.js, and it appears to parse out the id to figure out which action handler to call. Is there another method to generally resolve an id to the ActiveWidgets object it represents (not the DOM object)? I'd rather not break the encapsulation of what you're doing if I can.

PS - Could you please document your event model and how it bubbles? It's not clear to me that it's exactly the same as the javascript event model, and I would greatly appreciate more edification! ;)

Excellent product, thank you!
Robert
April 1,
I know - 95% of documentation is still missing ;-)

Short events overview:

You can set an event handler using setEvent method:

var myHandler = function(event){
...
}

obj.setEvent("onmouseover", myHandler);

The 'event' argument refers to the DOM event object, so it works consistently between IE and Mozilla.

var myHandler = function(event){
alert(event.srcElement.innerHTML);
}

Your event handler will be executed as a method of ActiveWidgets object, so you can use 'this' keyword to refer to it.

var myHandler = function(event){
this.setStyle("color", "red");
}

You can use 'this.element()' to obtain a reference to the corresponding DOM object.

If your object is template or control - you can access properties of the parent control data models:

var myHandler = function(event){
alert(this.getItemProperty("text"));
alert(this.getRowProperty("index"));
alert(this.getColumnProperty("index"));
}

Events do not bubble through ActiveWidgets template hierarchy (but they still do through corresponding DOM tree). Instead your event handler should get necessary parameters from the DOM event object and call ActiveWidgets action() method.

Actions are similar to events. You can assign action handler using setAction method, and you can define whatever action names you need. Also actions bubble through the hierarchy of ActiveWidgets templates and carry the reference to the originating template as a first argument.

var myEventHandler = function(event){
this.action("myActionName"); // call action to bubble up
}

childTemplate.setEvent("onclick", myEventHandler);

var myActionHandler = function(src){
alert(src.getItemProperty(...)); // src refers to the child template
alert(this.getDataProperty(...));// this refers to the parent template
}

parentTemplate.setAction("myActionName", myActionHandler);

Alex (ActiveWidgets)
April 2,
Could anybody please post a sample code on integrating overlib with activewidgets?
July 25,

This topic is archived.

See also:


Back to support forum