3.2.0

Selected row

Hi there,

Greetings,

I found script for context menu and used it. However, there is a problem:

I'm displaying selected cell data in alert() on right click. the data is display even if the row in not the selected row.

how can I make sure if the row I am right clicking on is the highlighted row?

thanks in advance

MAK
April 11,
I am looking for the same question, any ideas anybody?
MAK, have you found an answer?

Gran
August 8,
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.

John Ophof
August 8,
Actually, it is close to it...

Let me explain exactly...

Sometimes, the user makes a right click for context menu on a non selected line...

Therefore, what I want to do is to select the line on which the right click event occur before displaying the context menu that I have no problem to display...
But of course, if I don't select the line, then maybe no line is selected, or worse, another line is selected ... which corresponds to MAK's problem!

Txs

Gran
Gran
August 8,
Hi,

It is in our solution, isn't it?

http://open-modeling.dyndns.org/openmodeling215b choose modelbrowser for the tree menu and grids will appear in the right frame.

John Ophof
August 9,
Hi John,

It is true, I found the example where you indicated it, ... so I's gone to dig in the source files very soon to find the correct line, and I'll post it further on... but not before monday unfortunately...

Anyway, great examples...
Might publish mines when it will be completed!

Thxs

Gran
Gran
August 11,

This topic is archived.

See also:


Back to support forum