dwight
1
I’ve looked at the handleKeyPressed() examples in the demo1.java and implemented the same code in my view…
if (ctrl && ch == 1) { // Ctrl-A
selectAll();
} else if (ctrl && ch == 3) { // Ctrl-C
copy();
} else if (ctrl && ch == 24) { // Ctrl-X
cut();
} else if (ctrl && ch == 22) { // Ctrl-V
paste();
} else if (ctrl && ch == 25) { // Ctrl-Y
getDocument().redo();
} else if (ctrl && ch == 26) { // Ctrl-Z
getDocument().undo();
}
…the problem is that Ctrl-C and Ctrl-V don’t seem to act the standard way I would expect. Do I need more code???
dWiGhT
walter
2
How do they act differently from what you would expect?
dwight
3
Sorry… I should have said that they “don’t work”…
Whenever I select a node and do a CTRL-C then several CTRL-V… the expectation is that I get several copies of that node. I get nothing.
dWiGhT
walter
4
Are you sure? The copied nodes have the same position and size as the original node.
I suppose you could implement a JGoViewEvent.CLIPBOARD_PASTED JGoViewListener that moved the selection by a few pixels in some direction....
dwight
5
Wow… you are correct… and I must add, unexpected behavior.
butt, how would the evt object be moved?
doing a getJGoObject() within the JGoViewListener returns null…
dWiGhT
walter
6
Try calling view.moveSelection(view.getSelection(), 0, 2, 2, JGoView.EventMouseUp).
dwight
7
Works nicely… I did increase the move to 5,5 to make it more obvious.
dWiGhT