See
http://open-modeling.sourceforge.net you can download code
Some pieces out of it
Active.Templates.Text.prototype.setEvent ("oncontextmenu", oncontextmenu );
openmodelinggrid = Active.Controls.Grid.subclass();
openmodelinggrid.init = function () {
var obj = this.prototype;
obj.setAction("contextmenu", function(src) {
var nrowindex = src.getProperty("item/index");
var oselect = this.getProperty("selection/values");
var lfound = false;
// this code gives the same reaction as the context menu in windows used in Explorer
var nlen = oselect.length;
for (var i=0;i<nlen;i++) if (oselect[i] == nrowindex) lfound = true;
if (!lfound) {
oselect = new Array();
oselect.push (nrowindex);
this.setProperty("selection/values", oselect);
}
if (this.parent && this.parent.page) this.parent.page.showmenu (this.getOpenmodelingProperty ("currentevent"));
});
}
function oncontextmenu (e) {
if (this.setOpenmodelingProperty && this.getOpenmodelingProperty("contextmenu")) {
e.cancelBubble = true;
e.returnValue = false;
this.setOpenmodelingProperty ("currentevent", e); // handy to get the event and the src of the event in the routines
this.setOpenmodelingProperty ("contextmenuvisible", true);
if (this.action) this.action ("contextmenu");
}
}
This routine is showing the contextmenu this.parent.page.showmenu
If you are interested I can provide you with a piece of code reading XML stream into the grid out of Excel (using VBA to make the XML) and use this contextmenu.
But feel free to take a look.