User 247c00dc1d
29-10-2012 14:36:58
Hello! The presence of Code mode in the Grid view is perfect! How can I do next: if on table be double clic in some special cell in depending of The number or name (is more preferable) of the column , a script do somthing, but if a double clic into a cell from all other column they should only be opened to change the data.
onDoubleClick = { event ->
if (event.column == 3) //if its double clic in any cell from column #3, script do somthing
{ Runtime r = Runtime.getRuntime();
Process p = null;
p = r.exec('D:\\abc.exe');
println "in process"
}
else {code??} // curent cell should only be opened to change the data.
THANKS!!!!
ChemAxon 99d87cf303
29-10-2012 15:00:47
Hi,
you can affect the default behaviour of the double-click by return value from onDoubleClick closure. The return value says whether the event was consumed, by the closure, or not. Thus by returning:
- false you are saying to IJC that it should continue by performing default action - that is, it will start to edit the cell value
- true you are saying that double-click event was consumed and IJC shall not do anyting.
So the solution is to return false from your else clause.
if (event.column == 3) {
// do this and that
} else {
return false;
}
This allows you to process event, e.g. run external program as you
do, and then continue in default action. In this case you would just
return false from your if block.
HTH. Cheers,
- Martin
User 247c00dc1d
29-10-2012 15:20:51
Really simple, thanks!
Is it possible to do something like this:
... if (event.column.name = "smiles") ... \\smiles - the name of column
Thanks!
ChemAxon 99d87cf303
29-10-2012 15:37:06
Sorry, there is no official API for doing this.
A hacky solution is:
name = event.widget.table.getColumnName(event.column);
if (name == "smiles") {
// do something
}
But it is not guaranteed to work with future releases of IJC.
There is a plan to provide official way, but I'm unsure about timing.
Cheers,
-- Martin
User 247c00dc1d
01-11-2012 15:28:23
Thank you so much!
I hope this great feature will be a in a future releases.