TNGTextFormat

<< Click to Display Table of Contents >>

Navigation:  Data Formats >

TNGTextFormat

Previous pageReturn to chapter overviewNext page

TNGTextFormat class implements standard CF_TEXT data format and allows to drag/receive ANSI text data. NG Drag&Drop use AnsiString standard Delphi type for working with ANSI text data.

 

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

 

NGDropSource.Add(CF.TEXT.Data('My dragging text'))
            .Execute;
 
NGDropTarget.Register(MyTargetPanel, procedure(C: TNGTargetContext)
var
  s: AnsiString;
begin
  if C.Accept(CF.TEXT.Ref(@s)) then
    Edit1.Text := string(s);
end);

 

Moreover, special methods are declared for working with text data, which can simplify code even more:

 

NGDropSource.AddText('My dragging text')
            .Execute;
 
NGDropTarget.Register(MyTargetPanel, procedure(C: TNGTargetContext)
var
  s: AnsiString;
begin
  if C.AcceptText(@s) then
    Edit1.Text := string(s);
end);