Quote Originally Posted by Nouyana View Post
You can't do it just like that if you worry about backward compatibility. Let's say that somebody already use it this way:

Code:
Private Sub VBFlexGrid1_BeforeClipboardAction( _
                ByVal Action As FlexClipboardActionConstants, _
                      Text As String, Cancel As Boolean)
   Select Case Action
   Case FlexClipboardActionCopy, FlexClipboardActionCut
      ' Any conversion which could be performed twice:
      Text = Replace$(Text, "A", "AA")
      Text = "Header" & vbCr & Text & vbCr & "Footer"
   End Select
End Sub
If you will fire the BeforeCut and then BeforeCopy, it will cause a double conversion.



I see only two scenarios.

1. You may just remove the BeforeCut event (the FlexClipboardActionCut constant) and replace it with BeforeCopy and BeforeDelete. Code like the above will work fine, but maybe another code will work wrong.

2. You may add a property which will indicate a behavour: BeforeCut (default) or BeforeCopy+BeforeDelete.

Anyway, the Text in the BeforeCopy or BeforeCut is Ok now.



Yes. The text should be such that we can simply save it in memory and, if necessary, return it back (UnDo / ReDo) with the Paste method.
I see. I also found out that the .Delete method does not respect the ClipMode property (= ExcludeHidden).

I keep the BeforeCut event like it is. Not overcomplicating things ...
How about keeping the BeforeDelete event with empty Text and do below helper ? (this would solve to bother about BeforeCut)
Code:
Private Sub VBFlexGrid1_BeforeClipboardAction(ByVal Action As FlexClipboardActionConstants, Text As String, Cancel As Boolean)
Select Case Action
    Case FlexClipboardActionDelete
        Dim OldClipCopyMode As FlexClipCopyModeConstants
        OldClipCopyMode = VBFlexGrid1.ClipCopyMode
        VBFlexGrid1.ClipCopyMode = FlexClipCopyModeNormal
        Text = VBFlexGrid1.Clip ' Text is already a free provided variable.
        VBFlexGrid1.ClipCopyMode = OldClipCopyMode
        ' Do the rest.
End Select
End Sub