WPCubed Product Support

BeforeCutText bug

I was having a problem with users having a readonly RichText and still being able to Cut text from it. I found that the OnBeforeCutText wasn't getting called on a Cut, only on a Copy. Here is my patch, it may not be the approach you want to take, but it does solve the problem.
Tony

procedure TWPCustomRtfEdit.CutToClipboard;
var                             //ZNC 09/16/2005
  DoCut: boolean;               //ZNC 09/16/2005
begin
  if Assigned(FBeforeCutEvent) then    //ZNC 09/16/2005
    FBeforeCutEvent(Self, DoCut);      //ZNC 09/16/2005
  if not DoCut then exit;              //ZNC 09/16/2005

  FInCutToClipboard := TRUE;
  try
    CopyToClipboard;
    ClearSelection;
  finally
    FInCutToClipboard := FALSE;
  end;
end;

[/code]

#1 ♥ 0
4.8k Views 2 users read 1 min
support

Hi,

makes sense thanks, but a DoCut := TRUE; is missing.

Julian

#2 ♥ 0

Good point, I have added DoCut := True at the beginning of the procedure.

Can I expect this to be included in future releases?

Thanks,
Tony

#3 ♥ 0
This category is archived. No new posts are possible.