| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910 | <html><head><meta http-equiv="Content-Type"content="text/html; charset=iso-8859-1"><meta name="AUTHOR" content="Dieter Steinwedel"><meta name="DESCRIPTION"content="Drag&Drop component for Delphi; description for TDragDropFilesEx"><meta name="KEYWORDS"content="delphi, drag, drop, component, file, files, pidl, namespace, com, ole, freeware, windows"><meta name="GENERATOR" content="Microsoft FrontPage Express 2.0"><title>Details about TDragDropFilesEx</title></head><body bgcolor="#FFFFEF"><table border="0" cellspacing="0" width="600" bgcolor="#008080">    <tr>        <td width="10"> </td>        <td width="580"> </td>        <td width="10" bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td><p align="center"><font color="#FFFFFF" size="7"        face="Arial">TDragDropEx</font></p>        </td>        <td> </td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>        <td> </td>        <td> </td>    </tr></table><p align="left"> </p><p align="left"> </p><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Description</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b><i>TDragDropFilesEx</i></b> is        a comfortable and powerful component for COM/OLE        drag&drop operations with files and supports        completely the namespace of Windows (PIDL). The component        is a child-class from </font><a href="TDragDrop.htm"><font        face="Arial"><b><i>TDragDrop</i></b></font></a><font        face="Arial">.</font></td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Important        for Use</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial">This </font><a href="Index.htm"><font        face="Arial">file</font></a><font face="Arial">        (index.htm) contains more information about restrictions,        the disclaimer, remarks etc.</font></td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">History</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.30</b> </font><font        color="#808080" face="Arial">published on 17-Dec-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">Implementation of shell                extensions (drop- and drag&drop-handler)</font></li>            <li><font face="Arial">Changes in the <em><strong>FileList</strong></em>;                but no code breaking</font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.22</b> </font><font        color="#808080" face="Arial">published on 13-Nov-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">Small bug in RenderDropped                fixed; instead of <em><strong>GlobalFree</strong></em>                I use <em><strong>ReleaseStgMedium</strong></em>                for releasing resources</font></li>            <li><font face="Arial">The <em><strong>TFileList</strong></em>                has changed, because the items' type was                adjusted; now, you don't need any longer to do                type-casting on accessing the items in the list;                this modification should make the use of the list                a little bit easier; in order of this change,<em><strong>                TSortedList</strong></em> won't be any longer                used</font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.21</b> </font><font        color="#808080" face="Arial">published on 09-Jul-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">Small bug with property <b><i>FileNamesAreMapped</i></b>                fixed </font></li>            <li><font face="Arial">Bug with mapped filenames                under WinNT fixed </font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.20</b> </font><font        color="#808080" face="Arial">published on 06-Jul-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">Code re-design in result of                modifications in <b><i>TDragDrop</i></b>;                handling hasn't changed</font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.10</b> </font><font        color="#808080" face="Arial">published on 30-May-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">Is now able to handle mapped                filenames </font></li>            <li><font face="Arial">Some bugs fixed with filelist</font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.02</b> </font><font        color="#808080" face="Arial">published on 06-Jul-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">New property added: <b><i>CompleteFileList</i></b></font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.01</b> </font><font        color="#808080" face="Arial">published on 03-Oct-1999</font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">Small invisible bugs fixed</font></li>        </ul>        </td>    </tr>    <tr>        <td> </td>        <td><font face="Arial"><b>Version 1.00</b> </font><font        color="#808080" face="Arial">published on 06-Aug-1998</font><font        face="Arial"> </font></td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font face="Arial">First official release</font></li>        </ul>        </td>    </tr>    <tr>        <td height="50"> </td>        <td colspan="2"> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Properties</font></td>    </tr>    <tr>        <td> </td>    </tr></table><table border="0" cellpadding="3" cellspacing="0" width="600">    <tr>        <td width="10"> </td>        <td bgcolor="#008080"><font color="#FFFFFF" size="5"        face="Arial"><strong>inherited properties</strong></font></td>    </tr>    <tr>        <td rowspan="2"> </td>        <td bgcolor="#FFFFCC"><a href="TDragDrop.htm#Properties"><font        face="Arial">Click here ...</font></a></td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><font color="#FFFFFF" size="5"        face="Arial"><b>CompleteFileList </b></font><font        color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>    </tr>    <tr>        <td rowspan="2"> </td>        <td bgcolor="#FFFFCC"><font size="3" face="Arial">Here        you can determine, if the<b> </b></font><a        href="#FileList"><font size="3" face="Arial"><b><i>FileList</i></b></font></a><font        size="3" face="Arial"> should be automaticly completed or        not on calling </font><a href="#Execute"><font size="3"        face="Arial"><b><i>Execute</i></b></font></a><font        size="3" face="Arial"> and </font><a        href="TDragDrop.htm#CopyToClipBoard"><font size="3"        face="Arial"><b><i>CopyToClipBoard</i></b></font></a><font        size="3" face="Arial">. This was added the increase the        performance on some actions.</font></td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><a name="FileList"><font        color="#FFFFFF" size="5" face="Arial"><b>FileList</b></font></a><font        color="#FFFFFF" size="5" face="Arial"><b> </b></font><font        color="#FFFF80" size="2" face="Arial"><b><i>public</i></b></font></td>    </tr>    <tr>        <td> </td>        <td bgcolor="#FFFFCC"><font size="3" face="Arial"><b>For        Target:</b> Use this list in </font><a        href="TDragDrop.htm#OnProcessDropped"><font size="3"        face="Arial"><b><i>OnProcessDropped</i></b></font></a><font        size="3" face="Arial">, if you want to get the dropped        files.</font><p><font size="3" face="Arial"><b>For        Source:</b> Add the files to this list, that you want to        drag&drop, before calling </font><a href="#Execute"><font        size="3" face="Arial"><b><i>Execute</i></b></font></a><font        size="3" face="Arial">. Only if the pidl is available,        the drag&drop target can create a shortcut.</font></p>        <p><font color="#FF0000" size="3" face="Arial"><strong>Attention:</strong></font><font        size="3" face="Arial"> <em><strong>FileList</strong></em>        is an instance of </font><a href="#TFileList_Info"><font        size="3" face="Arial"><em><strong>TFileList</strong></em></font></a><font        size="3" face="Arial">!</font></p>        </td>    </tr>    <tr>        <td> </td>        <td> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><font color="#FFFFFF" size="5"        face="Arial"><b>NeedValid </b></font><font        color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>    </tr>    <tr>        <td rowspan="2"> </td>        <td bgcolor="#FFFFCC"><font size="3" face="Arial">Here,        you can determine, if the drag&drop data must have a        filename (set includes<b> </b><b><i>nvFilename</i></b>)        or </font><a href="#pidl_Info"><font size="3"        face="Arial">pidl</font></a><font size="3" face="Arial">        (set includes <b><i>nvPIDL</i></b>). This property        applies to receiving AND transmitting data.</font><p><font        size="3" face="Arial"><b>For Source:</b> Only if the        pidls are available, you can make a shortcut e.g. to the        desktop! </font></p>        </td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><a name="ShellExtensions"><font        color="#FFFFFF" size="5" face="Arial"><b>ShellExtensions</b></font></a><font        color="#FFFFFF" size="5" face="Arial"><b> </b></font><font        color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>    </tr>    <tr>        <td> </td>        <td bgcolor="#FFFFCC"><font size="3" face="Arial">This        property has two sub-properties:</font><ul>            <li><font size="3" face="Arial"><em><strong>DragDropHandler</strong></em></font></li>            <li><font size="3" face="Arial"><em><strong>DropHandler</strong></em></font></li>        </ul>        <p><font size="3" face="Arial">If the user drops data        with right mousebutton and the property </font><a        href="TDragDrop.htm#TargetPopUpMenu"><font size="3"        face="Arial"><em><strong>TargetPopUpMenu</strong></em></font></a><font        size="3" face="Arial"> and the sub-property <em><strong>DragDropHandler        </strong></em>is set to true, this component checks for a        available drag&drop-handler. For this you must        specify a drop-target in the event-handler </font><a        href="#OnSpecifyDropTarget"><font size="3" face="Arial"><em><strong>OnSpecifyDropTarget</strong></em></font></a><font        size="3" face="Arial">. The drop-target must be a        directory. If a drag&drop-handler is available for        the dropped data, there will be</font> <font face="Arial">corresponding        items added to to context-menu. If the user e</font><font        size="3" face="Arial">.g. drops ZIP-Files and Winzip is        installed, items like "Extract to ..." will        added to the context-menu. If the user selected such an        item, the dropped files will be extracted and you are        notified by the event </font><a        href="TDragDrop.htm#OnMenuSucceeded"><font size="3"        face="Arial"><em><strong>OnMenuSucceeded</strong></em></font></a><font        size="3" face="Arial">, that the extension was        successfully executed. Was the extension successfully        executed, the events </font><a        href="TDragDrop.htm#OnDrop"><font size="3" face="Arial"><em><strong>OnDrop</strong></em></font></a><font        size="3" face="Arial"> and </font><a        href="TDragDrop.htm#OnProcessDropped"><font size="3"        face="Arial"><em><strong>OnProcessDropped</strong></em></font></a><font        size="3" face="Arial"> won't be triggered.</font></p>        <p><font size="3" face="Arial">If the user drops files on        an other file and the sub-property <em><strong>DropHandler</strong></em>        is set to true, the drop-handler will be executed, if        available. The drop-handler will only executed, if you        specify in the event </font><a        href="#OnSpecifyDropTarget"><font size="3" face="Arial"><em><strong>OnSpecifyDropTarget</strong></em></font></a><font        size="3" face="Arial"> a file, for that is a drop-handler        defined in the registry. You can determine during a drop        with the method </font><a href="#TargetHasDropHandler"><font        size="3" face="Arial"><em><strong>TargetHasDropHandler</strong></em></font></a><font        size="3" face="Arial"> in the event </font><a        href="TDragDrop.htm#OnDragOver"><font size="3"        face="Arial"><em><strong>OnDragOver</strong></em></font></a><font        size="3" face="Arial">, if the file has a drop-handler.        If the drop-handler was successfully executed, the event </font><a        href="TDragDrop.htm#OnDropHandlerSucceeded"><font        size="3" face="Arial"><em><strong>OnDropHandlerSucceeded</strong></em></font></a><font        size="3" face="Arial"> will triggered. A drop-handler        will be executed, if the user drops a file/directory on a        ZIP-File and Winzip is installed. The dropped        file/directory will be added to ZIP-file.</font></p>        </td>    </tr>    <tr>        <td> </td>        <td height="50"> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Events</font></td>    </tr>    <tr>        <td> </td>    </tr></table><table border="0" cellpadding="3" cellspacing="0" width="600">    <tr>        <td width="10"> </td>        <td bgcolor="#008080"><font color="#FFFFFF" size="5"        face="Arial"><strong>inherited events</strong></font></td>    </tr>    <tr>        <td rowspan="2"> </td>        <td bgcolor="#FFFFCC"><a href="TDragDrop.htm#Events"><font        face="Arial">Click here ...</font></a></td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><a name="OnSpecifyDropTarget"><font        color="#FFFFFF" size="5" face="Arial"><strong>OnSpecifyDropTarget</strong></font></a><font        color="#FFFFFF" size="5" face="Arial"><strong> </strong></font><font        color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>    </tr>    <tr>        <td> </td>        <td bgcolor="#FFFFCC"><font size="3" face="Arial">This        event will be triggered by the sub-properties of the        property </font><a href="#ShellExtensions"><font size="3"        face="Arial"><em><strong>ShellExtensions</strong></em></font></a><font        size="3" face="Arial">. You must specify a drop-target        (file/directory) by the filename or pidl. You don't need        to specify both values, but it doesn't harm. If no        drop-target is specified, the shell extensions won't be        executed.</font></td>    </tr>    <tr>        <td> </td>        <td height="50"> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10"> </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Methods</font></td>    </tr>    <tr>        <td> </td>    </tr></table><table border="0" cellpadding="3" cellspacing="0" width="600">    <tr>        <td width="10"> </td>        <td bgcolor="#008080"><font color="#FFFFFF" size="5"        face="Arial"><strong>inherited methods</strong></font></td>    </tr>    <tr>        <td rowspan="2"> </td>        <td bgcolor="#FFFFCC"><a href="TDragDrop.htm#Methods"><font        face="Arial">Click here ...</font></a></td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><a name="Execute"><font        color="#FFFFFF" size="5" face="Arial"><b>Execute</b></font></a><font        color="#FFFFFF" size="5" face="Arial"><b> </b></font><font        color="#FFFF80" size="2" face="Arial"><b><i>public</i></b></font></td>    </tr>    <tr>        <td rowspan="2"> </td>        <td bgcolor="#FFFFCC"><font size="3" face="Arial">Call        this method, if you detect that the user wants to start a        drag&drop operation (e.g. MouseDown+MouseMove). Also        look: </font><a href="#FileList"><font size="3"        face="Arial"><em><strong>FileList</strong></em></font></a><font        size="3" face="Arial">.</font><p><font size="3"        face="Arial">For drag detection you can also use the        inherited property </font><a        href="TDragDrop.htm#AutoDetectDnD"><font size="3"        face="Arial"><em><strong>AutotDetectDnD</strong></em></font></a><font        size="3" face="Arial"> or the method </font><a        href="TDragDrop.htm#StartDnDDetection"><font size="3"        face="Arial"><em><strong>StartDnDDetection</strong></em></font></a><font        size="3" face="Arial">.</font></p>        <p><font color="#FF0000" size="3" face="Arial"><strong>IMPORTANT:</strong></font><font        size="3" face="Arial"> If you use the drag-detection,        it's high recommended to check the section "</font><a        href="TDragDrop.htm#DragDetectionProblem"><font size="3"        face="Arial">Problems With The Drag-Detection</font></a><font        size="3" face="Arial">".</font></p>        </td>    </tr>    <tr>        <td bgcolor="#FFFFEF"> </td>    </tr>    <tr>        <td> </td>        <td bgcolor="#008080"><a name="TargetHasDropHandler"><font        color="#FFFFFF" size="5" face="Arial"><b>TargetHasDropHandler</b></font></a><font        color="#FFFFFF" size="5" face="Arial"><b> </b></font><font        color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>    </tr>    <tr>        <td> </td>        <td bgcolor="#FFFFCC"><font face="Arial">You can use this        method to determine, if a drop-target (file) has a        drop-handler or not. Normally, you will use this method        in the event </font><a href="TDragDrop.htm#OnDragOver"><font        size="3" face="Arial"><em><strong>OnDragOver</strong></em></font></a><font        size="3" face="Arial"> to determine, if visual updates        are necessary (e.g. selecting a file etc.).</font></td>    </tr>    <tr>        <td> </td>        <td height="50"> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10"> </td>        <td rowspan="2" colspan="2" width="590"><font size="5"        face="Arial">How Do I Use It As Drag&Drop Source</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">1.</font></td>        <td><font face="Arial">Drop a TWinControl on the form        (e.g. a listbox).</font></td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">2.</font></td>        <td><font face="Arial">Choose the TWinControl (listbox)        in </font><a href="TDragDrop.htm#DragDropControl"><font        face="Arial"><em><strong>DragDropControl</strong></em></font></a><font        face="Arial">.</font></td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">3. </font></td>        <td><font face="Arial">Choose the drag&drop effects        under </font><a href="TDragDrop.htm#SourceEffects"><font        face="Arial"><em><strong>SourceEffects</strong></em></font></a><font        face="Arial"> which the <em><strong>DragDropControl </strong></em>(listbox)        should support. If you don't want any longer that the <em><strong>DragDropControl</strong></em>        serve as drag&drop source all items must be set to        false.</font></td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">4.</font></td>        <td><font face="Arial">Now, your <em><strong>DragDropControl</strong></em>        (listbox) must detect, if the user wants to start a        drag&drop operation. You can use the event        "OnMouseDown" of your <em><strong>DragDropControl</strong></em>        (listbox). Add following to the event:</font><blockquote>            <p><font face="Arial"><code>DragDropFiles1.FileList.AddItem(<absolute            pidl of file, if available, or nil>, <selected            item in </code></font><a            href="TDragDrop.htm#DragDropControl"><font            face="Arial"><code><em><strong>DragDropControl</strong></em></code></font></a><font            face="Arial"><code> (listbox)>);</code></font></p>        </blockquote>        <p><font face="Arial">You must add the filenames        including the WHOLE PATH!!!</font></p>        </td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">5.</font></td>        <td valign="top"><font face="Arial">Tell Windows that        there is a drag&drop operation to handle: Just call        the method </font><a href="TDragDrop.htm#Execute"><font        face="Arial"><em><strong>Execute</strong></em></font></a><font        face="Arial"> of this component. </font></td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top"><font face="Arial">6.</font></td>        <td valign="top"><font size="3" face="Arial">You may use        the events </font><a href="TDragDrop.htm#OnGiveFeedback"><font        size="3" face="Arial"><b><i>OnGiveFeedback</i></b></font></a><font        size="3" face="Arial"> and </font><a        href="TDragDrop.htm#OnQueryContinueDrag"><font size="3"        face="Arial"><b><i>OnQueryContinueDrag</i></b></font></a><font        size="3" face="Arial">, but often you need not.</font></td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top"> </td>        <td valign="top"> </td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top" colspan="2"><font face="Arial"><strong>Hints:</strong></font></td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top" colspan="2"><ul>            <li><font size="3" face="Arial">Drag&drop                operations cannot be done at design-time!</font></li>            <li><font size="3" face="Arial">IMPORTANT: If you use                the drag-detection, it's high recommended to                check the section "</font><a                href="TDragDrop.htm#DragDetectionProblem"><font                size="3" face="Arial">Problems With The                Drag-Detection</font></a><font size="3"                face="Arial">".</font></li>        </ul>        </td>    </tr>    <tr>        <td height="50"> </td>        <td colspan="2"> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10"> </td>        <td rowspan="2" colspan="2" width="590"><font size="5"        face="Arial">How Do I Use It As Drag&Drop Target</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">1.</font></td>        <td><font face="Arial">Drop a TWinControl on the form        (e.g. a listbox).</font></td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">2.</font></td>        <td><font face="Arial">Choose the TWinControl (listbox)        in </font><a href="TDragDrop.htm#DragDropControl"><font        face="Arial"><em><strong>DragDropControl</strong></em></font></a><font        face="Arial">.</font></td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">3. </font></td>        <td><font face="Arial">Choose the drag&drop effects        under </font><a href="TDragDrop.htm#TargetEffects"><font        face="Arial"><em><strong>TargetEffects</strong></em></font></a><font        face="Arial"> which the <em><strong>DragDropControl </strong></em>(listbox)        should support. If you don't want any longer that the <em><strong>DragDropControl</strong></em>        serve as drag&drop target all items must be set to        false.</font></td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">4.</font></td>        <td><font size="3" face="Arial">Now, you have to program        what happen, if the user drops files on your </font><a        href="TDragDrop.htm#DragDropControl"><font size="3"        face="Arial"><b><i>DragDropControl</i></b></font></a><font        size="3" face="Arial"> (listbox). For this, the best is        to use the event </font><a        href="TDragDrop.htm#OnProcessDropped"><font size="3"        face="Arial"><b><i>OnProcessDropped</i></b></font></a><font        size="3" face="Arial">. At first, you should check what        drag&drop effect was chosen by the user. You get the        effect from method's parameter <b><i>dwEffect</i></b>.        You get the files from this component with following        line:</font><blockquote>            <p><font size="3" face="Arial"><code>...            :=DragDropFiles1.FileList[<Index>]^.Name; <br>            </code></font><font color="#000080" size="3"            face="Arial"><code><strong><i>// returns the            filename; if not available, the result is an empty            string</i></strong></code></font><font size="3"            face="Arial"><code><strong><br>            </strong></code><code>...            :=DragDropFiles1.FileList[<Index>]^.pidlFQ; <br>            </code></font><font color="#000080" size="3"            face="Arial"><code><strong><i>// returns the pidl; if            not available, the result is nil</i></strong></code></font></p>        </blockquote>        <p><a href="#FileList"><font size="3" face="Arial"><b><i>FileList</i></b></font></a><font        size="3" face="Arial"> is an instance of </font><a        href="#TFileList_Info"><font size="3" face="Arial"><em><strong>TFileList</strong></em></font></a><font        size="3" face="Arial">. For more info check </font><a        href="#TFileList_Info"><font size="3" face="Arial">below</font></a><font        size="3" face="Arial">. Now, do with the files what you        have to do, e.g. copy, move, delete, etc.</font></p>        </td>    </tr>    <tr>        <td> </td>        <td valign="top"><font face="Arial">5.</font></td>        <td valign="top"><font size="3" face="Arial">You may use        the events </font><a href="TDragDrop.htm#OnDragEnter"><font        size="3" face="Arial"><b><i>OnDragEnter</i></b></font></a><font        size="3" face="Arial">, </font><a        href="TDragDrop.htm#OnDragOver"><font size="3"        face="Arial"><b><i>OnDragOver</i></b></font></a><font        size="3" face="Arial"> and </font><a        href="TDragDrop.htm#OnDragLeave"><font size="3"        face="Arial"><b><i>OnDragLeave</i></b></font></a><font        size="3" face="Arial">, but often you need not.</font></td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top"> </td>        <td valign="top"> </td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top" colspan="2"><font face="Arial"><strong>Hints:</strong></font></td>    </tr>    <tr>        <td valign="top"> </td>        <td valign="top" colspan="2"><ul>            <li><font size="3" face="Arial">Drag&drop                operations cannot be done at design-time!</font></li>        </ul>        </td>    </tr>    <tr>        <td height="50"> </td>        <td colspan="2"> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><a name="TFileList_Info"><font        size="5" face="Arial">Details about <strong>TFileList</strong></font></a></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font size="3" face="Arial"><b><i>TFileList</i></b>        is a child of <b><i>TList</i></b>. Therefore, I don't        explain the list, again. You can find a documentation in        the online-help. Now, the new features of <b><i>TFileList</i></b>:</font><p><font        size="3" face="Arial">You add items to the list with the        function <b><i>AddItem</i></b> (or <b><i>AddItemEx</i></b>,        if you want to use mapped filenames). The function make        itself a copy of the pidl (absolute needed!) to relieve        you of this dirty job. If you don't know the pidl, set        the parameter to nil. If you don't know or have the        filename (including the whole path), set this parameter        to a emtpy string.</font></p>        <p><font size="3" face="Arial">You can delete items or        clear as common to lists. You needn't care about        releasing resources - the <b><i>TFileList</i></b> cares        about itself!</font></p>        <p><font size="3" face="Arial">Besides, there are the        functions <b><i>RenderPIDLs</i></b> and <b><i>RenderNames</i></b>.        <b><i>RenderPIDLs</i></b> tries to get the according        pidls to the filenames in the list. <b><i>RenderNames</i></b>        tries to get the according filenames (including full        path) to the pidls in the list. If the functions succeed        the result is true else false. You need not to call them        before a drag&drop operation. This will be        automaticly done by the component itself, if you set the        property <b><i>CompleteFileList</i></b> to true. But it        may be useful to call them after receiving data to        complete the list. </font></p>        </td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><a name="pidl_Info"><font        size="5" face="Arial">Details about <strong>PIDL</strong>s</font></a></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font size="3" face="Arial">Since Win95 the        file-system is more difficult. It is object orientated        and is named "namespace". Every file, folder,        etc. is an object in the object-tree of the namespace.        Every object is an instance of the class <b><i>IShellFolder</i></b>        (more info in the online-help). If you have the instance        of the object, you can many do. E.g. you can determine        the properties (attributes) of the object (is it a file?,        is it a folder?, can I copy it?, ...). Every object can        be identified by an ID: the <b><i>pidl</i></b>. By the        pidl you can determine the IShellFolder-instance (use the        enclosed unit "pidl"; description only in the        code available).</font><p><font size="3" face="Arial">Pay        attention about relative and absolute pidls. The instance        itself has only a relative pidl (sometimes named as        "item pidl"). The path of concatenated pidls        from the root-object (desktop) to the child-object is the        absolute pidl! Pay attentions about this difference. You        can quickly fooled!</font></p>        <p><font size="3" face="Arial">Very important: Shortscuts        are only possible, if the pidl is available.</font></p>        </td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Details        about <strong>mapped filenames</strong></font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font size="3" face="Arial">If a mapped filename is        set, the source inform you, that you have to rename the        received name into the mapped name after to        d&d-operation. The mapped filenames are used, if you        drag files from the "RecycleBin".</font></td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10"> </td>        <td rowspan="2" width="590"><font size="5" face="Arial">FAQ</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><font size="3" face="Arial"><b>Q:</b> My application        supports only some special file-formats. How can I forbid        the other formats during the drop?</font><p><font        size="3" face="Arial"><b>A:</b> Set the property </font><a        href="TDragDrop.htm#RenderOn"><font size="3" face="Arial"><em><strong>RenderOn</strong></em></font></a><font        size="3" face="Arial"> to <b><i>rdoDropEnterAndDropSync</i></b>        and check out the </font><a href="#FileList"><font        size="3" face="Arial"><em><strong>Filelist</strong></em></font></a><font        size="3" face="Arial"> in the event </font><a        href="TDragDrop.htm#OnDragEnter"><font size="3"        face="Arial"><b><i>OnDragEnter</i></b></font></a><font        size="3" face="Arial">. Set the parameter <em><strong>Accept</strong></em>        in this event to true, if your application support the        files in the <em><strong>Filelist</strong></em> otherwise        set the parameter to false. If you only use the first        file, check only the first item in the <em><strong>Filelist</strong></em>.</font></p>        </td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><table border="0" width="600">    <tr>        <td width="10" bgcolor="#008080" height="10">  </td>        <td rowspan="2" width="590"><font size="5" face="Arial">Known        Bugs</font></td>    </tr>    <tr>        <td> </td>    </tr>    <tr>        <td> </td>        <td><ul>            <li><font size="3" face="Arial">Shortcuts are only                possible, if the pidl is available (not really a                bug) </font></li>        </ul>        </td>    </tr>    <tr>        <td height="50"> </td>        <td> </td>    </tr></table><hr><p><font size="3" face="Arial"><i>© 1998,99 by </i></font><ahref="mailto:[email protected]"><font size="3" face="Arial"><i>DieterSteinwedel</i></font></a><font size="3" face="Arial"> </font></p><p><a href="Index.htm"><font face="Arial">Back</font></a><fontface="Arial"> to index</font></p></body></html>
 |