Flex: How to ensure CutOperation puts the cut text on the clipboard?
I have a class that inherits from EditManager and provides these methods:
public function performCopy():voi开发者_开发问答d
{
var copyOperation:CopyOperation = new CopyOperation( getSelectionState() );
doOperation( copyOperation );
}
public function performCut():void
{
var textToCut:TextScrap = TextScrap.createTextScrap( getSelectionState() );
var cutOperation:CutOperation = new CutOperation( getSelectionState(), textToCut );
doOperation( cutOperation );
}
PerformCopy works fine and puts the copied text on the clipboard.
PerformCut removes the text as expected but does not put it on the clipboard.
The CutOperation documentation says "The edit manager is responsible for copying the text scrap to the clipboard. Undoing a cut operation does not restore the original clipboard state."
Any idea what I might be doing wrong?
Thanks Stefan
This does the trick or calling a CopyOperation before:
public function performCut():void
{
var textToCut:TextScrap = TextScrap.createTextScrap( getSelectionState() );
TextClipboard.setContents( textToCut );
var cutOperation:CutOperation = new CutOperation( getSelectionState(), textToCut );
doOperation( cutOperation );
}
Just unexpected behavior of CutOperation.
精彩评论