TNGHDropFormat

<< Click to Display Table of Contents >>

Navigation:  Data Formats >

TNGHDropFormat

Previous pageReturn to chapter overviewNext page

TNGHDropFormat class implements standard CF_HDROP data format and allows to drag/receive really existing files. NG Drag&Drop use TNGStrArray type, which is a dynamic array of string, for working with CF_HDROP data. The data should contain one or more really existing file paths.

 

The class declares two methods: Data and Ref. Data method can be used to drag file paths 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.HDROP to make user's code more readable:

 

SetLegnth(s, 3);
s[0] := 'c:\MyText1.txt';
s[0] ;= 'c:\MyText2.txt';
s[0] := 'c:\MyText3.txt';

 
NGDropSource.Add(CF.HDROP.Data(s))
            .Execute;

 
NGDropTarget.Register(MyTargetPanel, procedure(C: TNGTargetContext)
var
  s: TNGStrArray;
begin
  if C.Accept(CF.HDROP.Ref(@s)) then
    ShowFiles(s);
end);