NG Drag&Drop Guide


TNGRtfFormat


TNGRtfFormat class implements common RTF data format and allows to drag/receive Rich Text Format data. As specified, RTF data is sequence of 7-bit ASCII chars, and so, NG Drag&Drop use RawByteString standard Delphi type for working with RTF.

 

The class declares two methods: Data and Ref. Data method can be used to drag RTF data at the source side, while Ref method can be used to receive RTF at the target side. NG Drag&Drop declares special type alias CF.RTF to make user's code more readable:

 

NGDropSource.Add(CF.RTF.Data(s))

            .Execute;

 

NGDropTarget.Register(MyTargetPanel, procedure(C: TNGTargetContext)

var

  s: RawByteString;

begin

  if C.Accept(CF.RTF.Ref(@s)) then

    ShowRtf(s);

end);

 

Please look at provided demo project to understand how to get RTF data from TRichEdit Delphi component, and how to set it back.