:: Forum >>

Grid: Text selection in IE

Hi,

with Firefox it's possible to select some text in a grid cell and copy just that piece of text to the clipboard (I don't talk about the functionality of copying the whole selected row(s) to the clipboard).

With Internet Explorer (tested with 7 and 8) this is not possible; it seems that text selection is disabled here.

Is there any way to activate text selection for Internet Explorer?


Best regards,

Andy
Andy
Thursday, November 10, 2011
By the way:
Chrome and Opera behaves exactly like IE, simple text-selection isn't possible.

Is there any way to reactivate text-selection, so it behaves like Firefox?
Andy
Friday, November 11, 2011
I did not find an easy way to do it. You can enable selection if you remove the focus callback, but that may break selection and copy/paste functionality -


obj.setEvent("onselectstart", "");
obj.focus = function(){};
Alex (ActiveWidgets)
Sunday, November 13, 2011
Hi Alex,

thanks for your answer. I use a different way now. Here is a simplified example:


var mouse = {
cell: {
row: -1,
col: -1
}
};

...

obj.onCellMouseDown = function(_ev, col, row) {
mouse.cell.row = row;
mouse.cell.col = col;
};

obj.getSelectedTextDefault = obj.getSelectedText;

obj.getSelectedText = function() {
if ( ( mouse.cell.col != -1 ) && ( mouse.cell.row != -1 ) ) {
if ( this.getCellTemplate(mouse.cell.col).constructor == (new AW.Templates.Image).constructor ) {
return '';
} else {
return this.getCellText(mouse.cell.col, mouse.cell.row);
}
}

if ( this.getSelectedTextDefault != null ) {
return this.getSelectedTextDefault()
} else {
return '';
}
};


obj.setEvent('onkeydown', function(_ev) {
var ev = ( window.event ? window.event : _ev );
if ( ev.ctrlKey ) {
mouse.cell.col = -1;
mouse.cell.row = -1;
}
});



Now it's possible to copy the text content of the active cell to the clipboard via context menu (only in Firefox and IE, but that's okay). And it's still possible to copy the whole row to the clipboard via STRG + C.


Best regards,

Andy
Andy
Monday, November 14, 2011

This topic is archived.


Back to support forum

Forum search