Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic About the edit function of the Diagram (Read 2007 times)
ragnarok00
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Nov 14th, 2008
About the edit function of the Diagram
Apr 13th, 2009 at 7:19am
Print Post  
Hi,
I have the following question about the code. T^T

Code
Select All
private void onEditUndo(ActionEvent e)
{
_flowChart.getUndoManager().undo();
}

private void onEditRedo(ActionEvent e)
{
_flowChart.getUndoManager().redo();
}
 


I have the above coding for undo and redo functions, but they don't work, how can I solve this problem?

Besides, I have written some code for Cut, Copy, and Paste function, but I am not sure whether they are correct and cannot paste the object I copied for more than one time by using the paste function.
Here is the code:
Code
Select All
private void onEditCut(ActionEvent e)
{
sel = _flowChart.copySelection(_flowChart, false, true);
_flowChart.getActiveItem().setVisible(false);
}

private void onEditCopy(ActionEvent e)
{
sel = _flowChart.copySelection(_flowChart, false, true);
}

private void onEditPaste(ActionEvent e)
{
CompositeCmd cmd = new CompositeCmd(_flowChart, "copied");
_flowChart.pasteSelection(_flowChart, sel, cmd, 10, 10);
}
 



Thanks. ^^
  
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: About the edit function of the Diagram
Reply #1 - Apr 13th, 2009 at 9:07am
Print Post  
Call UndoManager.setUndoEnabled() to enable undo/redo. Use the copyToClipboard and pasteFromClipboard methods of DiagramView to implement clipboard support. You should use a larger offset values for each paste() call to make sure newly pasted items do not overlap the ones pasted previously.

I hope that helps,
Stoyan
  
Back to top
 
IP Logged
 
ragnarok00
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 4
Joined: Nov 14th, 2008
Re: About the edit function of the Diagram
Reply #2 - Apr 13th, 2009 at 10:45am
Print Post  
It works. Thanks a lot. >3<
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint