TDragDropFilesEx.htm 37 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Type"
  4. content="text/html; charset=iso-8859-1">
  5. <meta name="AUTHOR" content="Dieter Steinwedel">
  6. <meta name="DESCRIPTION"
  7. content="Drag&amp;Drop component for Delphi; description for TDragDropFilesEx">
  8. <meta name="KEYWORDS"
  9. content="delphi, drag, drop, component, file, files, pidl, namespace, com, ole, freeware, windows">
  10. <meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
  11. <title>Details about TDragDropFilesEx</title>
  12. </head>
  13. <body bgcolor="#FFFFEF">
  14. <table border="0" cellspacing="0" width="600" bgcolor="#008080">
  15. <tr>
  16. <td width="10">&nbsp;</td>
  17. <td width="580">&nbsp;</td>
  18. <td width="10" bgcolor="#FFFFEF">&nbsp;</td>
  19. </tr>
  20. <tr>
  21. <td>&nbsp;</td>
  22. <td><p align="center"><font color="#FFFFFF" size="7"
  23. face="Arial">TDragDropEx</font></p>
  24. </td>
  25. <td>&nbsp;</td>
  26. </tr>
  27. <tr>
  28. <td bgcolor="#FFFFEF">&nbsp;</td>
  29. <td>&nbsp;</td>
  30. <td>&nbsp;</td>
  31. </tr>
  32. </table>
  33. <p align="left">&nbsp;</p>
  34. <p align="left">&nbsp;</p>
  35. <table border="0" width="600">
  36. <tr>
  37. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  38. <td rowspan="2" width="590"><font size="5" face="Arial">Description</font></td>
  39. </tr>
  40. <tr>
  41. <td>&nbsp;</td>
  42. </tr>
  43. <tr>
  44. <td>&nbsp;</td>
  45. <td><font face="Arial"><b><i>TDragDropFilesEx</i></b> is
  46. a comfortable and powerful component for COM/OLE
  47. drag&amp;drop operations with files and supports
  48. completely the namespace of Windows (PIDL). The component
  49. is a child-class from </font><a href="TDragDrop.htm"><font
  50. face="Arial"><b><i>TDragDrop</i></b></font></a><font
  51. face="Arial">.</font></td>
  52. </tr>
  53. <tr>
  54. <td height="50">&nbsp;</td>
  55. <td>&nbsp;</td>
  56. </tr>
  57. </table>
  58. <table border="0" width="600">
  59. <tr>
  60. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  61. <td rowspan="2" width="590"><font size="5" face="Arial">Important
  62. for Use</font></td>
  63. </tr>
  64. <tr>
  65. <td>&nbsp;</td>
  66. </tr>
  67. <tr>
  68. <td>&nbsp;</td>
  69. <td><font face="Arial">This </font><a href="Index.htm"><font
  70. face="Arial">file</font></a><font face="Arial">
  71. (index.htm) contains more information about restrictions,
  72. the disclaimer, remarks etc.</font></td>
  73. </tr>
  74. <tr>
  75. <td height="50">&nbsp;</td>
  76. <td>&nbsp;</td>
  77. </tr>
  78. </table>
  79. <table border="0" width="600">
  80. <tr>
  81. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  82. <td rowspan="2" width="590"><font size="5" face="Arial">History</font></td>
  83. </tr>
  84. <tr>
  85. <td>&nbsp;</td>
  86. </tr>
  87. <tr>
  88. <td>&nbsp;</td>
  89. <td><font face="Arial"><b>Version 1.30</b> </font><font
  90. color="#808080" face="Arial">published on 17-Dec-1999</font></td>
  91. </tr>
  92. <tr>
  93. <td>&nbsp;</td>
  94. <td><ul>
  95. <li><font face="Arial">Implementation of shell
  96. extensions (drop- and drag&amp;drop-handler)</font></li>
  97. <li><font face="Arial">Changes in the <em><strong>FileList</strong></em>;
  98. but no code breaking</font></li>
  99. </ul>
  100. </td>
  101. </tr>
  102. <tr>
  103. <td>&nbsp;</td>
  104. <td><font face="Arial"><b>Version 1.22</b> </font><font
  105. color="#808080" face="Arial">published on 13-Nov-1999</font></td>
  106. </tr>
  107. <tr>
  108. <td>&nbsp;</td>
  109. <td><ul>
  110. <li><font face="Arial">Small bug in RenderDropped
  111. fixed; instead of <em><strong>GlobalFree</strong></em>
  112. I use <em><strong>ReleaseStgMedium</strong></em>
  113. for releasing resources</font></li>
  114. <li><font face="Arial">The <em><strong>TFileList</strong></em>
  115. has changed, because the items' type was
  116. adjusted; now, you don't need any longer to do
  117. type-casting on accessing the items in the list;
  118. this modification should make the use of the list
  119. a little bit easier; in order of this change,<em><strong>
  120. TSortedList</strong></em> won't be any longer
  121. used</font></li>
  122. </ul>
  123. </td>
  124. </tr>
  125. <tr>
  126. <td>&nbsp;</td>
  127. <td><font face="Arial"><b>Version 1.21</b> </font><font
  128. color="#808080" face="Arial">published on 09-Jul-1999</font></td>
  129. </tr>
  130. <tr>
  131. <td>&nbsp;</td>
  132. <td><ul>
  133. <li><font face="Arial">Small bug with property <b><i>FileNamesAreMapped</i></b>
  134. fixed </font></li>
  135. <li><font face="Arial">Bug with mapped filenames
  136. under WinNT fixed </font></li>
  137. </ul>
  138. </td>
  139. </tr>
  140. <tr>
  141. <td>&nbsp;</td>
  142. <td><font face="Arial"><b>Version 1.20</b> </font><font
  143. color="#808080" face="Arial">published on 06-Jul-1999</font></td>
  144. </tr>
  145. <tr>
  146. <td>&nbsp;</td>
  147. <td><ul>
  148. <li><font face="Arial">Code re-design in result of
  149. modifications in <b><i>TDragDrop</i></b>;
  150. handling hasn't changed</font></li>
  151. </ul>
  152. </td>
  153. </tr>
  154. <tr>
  155. <td>&nbsp;</td>
  156. <td><font face="Arial"><b>Version 1.10</b> </font><font
  157. color="#808080" face="Arial">published on 30-May-1999</font></td>
  158. </tr>
  159. <tr>
  160. <td>&nbsp;</td>
  161. <td><ul>
  162. <li><font face="Arial">Is now able to handle mapped
  163. filenames </font></li>
  164. <li><font face="Arial">Some bugs fixed with filelist</font></li>
  165. </ul>
  166. </td>
  167. </tr>
  168. <tr>
  169. <td>&nbsp;</td>
  170. <td><font face="Arial"><b>Version 1.02</b> </font><font
  171. color="#808080" face="Arial">published on 06-Jul-1999</font></td>
  172. </tr>
  173. <tr>
  174. <td>&nbsp;</td>
  175. <td><ul>
  176. <li><font face="Arial">New property added: <b><i>CompleteFileList</i></b></font></li>
  177. </ul>
  178. </td>
  179. </tr>
  180. <tr>
  181. <td>&nbsp;</td>
  182. <td><font face="Arial"><b>Version 1.01</b> </font><font
  183. color="#808080" face="Arial">published on 03-Oct-1999</font></td>
  184. </tr>
  185. <tr>
  186. <td>&nbsp;</td>
  187. <td><ul>
  188. <li><font face="Arial">Small invisible bugs fixed</font></li>
  189. </ul>
  190. </td>
  191. </tr>
  192. <tr>
  193. <td>&nbsp;</td>
  194. <td><font face="Arial"><b>Version 1.00</b> </font><font
  195. color="#808080" face="Arial">published on 06-Aug-1998</font><font
  196. face="Arial"> </font></td>
  197. </tr>
  198. <tr>
  199. <td>&nbsp;</td>
  200. <td><ul>
  201. <li><font face="Arial">First official release</font></li>
  202. </ul>
  203. </td>
  204. </tr>
  205. <tr>
  206. <td height="50">&nbsp;</td>
  207. <td colspan="2">&nbsp;</td>
  208. </tr>
  209. </table>
  210. <table border="0" width="600">
  211. <tr>
  212. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  213. <td rowspan="2" width="590"><font size="5" face="Arial">Properties</font></td>
  214. </tr>
  215. <tr>
  216. <td>&nbsp;</td>
  217. </tr>
  218. </table>
  219. <table border="0" cellpadding="3" cellspacing="0" width="600">
  220. <tr>
  221. <td width="10">&nbsp;</td>
  222. <td bgcolor="#008080"><font color="#FFFFFF" size="5"
  223. face="Arial"><strong>inherited properties</strong></font></td>
  224. </tr>
  225. <tr>
  226. <td rowspan="2">&nbsp;</td>
  227. <td bgcolor="#FFFFCC"><a href="TDragDrop.htm#Properties"><font
  228. face="Arial">Click here ...</font></a></td>
  229. </tr>
  230. <tr>
  231. <td bgcolor="#FFFFEF">&nbsp;</td>
  232. </tr>
  233. <tr>
  234. <td>&nbsp;</td>
  235. <td bgcolor="#008080"><font color="#FFFFFF" size="5"
  236. face="Arial"><b>CompleteFileList </b></font><font
  237. color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>
  238. </tr>
  239. <tr>
  240. <td rowspan="2">&nbsp;</td>
  241. <td bgcolor="#FFFFCC"><font size="3" face="Arial">Here
  242. you can determine, if the<b> </b></font><a
  243. href="#FileList"><font size="3" face="Arial"><b><i>FileList</i></b></font></a><font
  244. size="3" face="Arial"> should be automaticly completed or
  245. not on calling </font><a href="#Execute"><font size="3"
  246. face="Arial"><b><i>Execute</i></b></font></a><font
  247. size="3" face="Arial"> and </font><a
  248. href="TDragDrop.htm#CopyToClipBoard"><font size="3"
  249. face="Arial"><b><i>CopyToClipBoard</i></b></font></a><font
  250. size="3" face="Arial">. This was added the increase the
  251. performance on some actions.</font></td>
  252. </tr>
  253. <tr>
  254. <td bgcolor="#FFFFEF">&nbsp;</td>
  255. </tr>
  256. <tr>
  257. <td>&nbsp;</td>
  258. <td bgcolor="#008080"><a name="FileList"><font
  259. color="#FFFFFF" size="5" face="Arial"><b>FileList</b></font></a><font
  260. color="#FFFFFF" size="5" face="Arial"><b> </b></font><font
  261. color="#FFFF80" size="2" face="Arial"><b><i>public</i></b></font></td>
  262. </tr>
  263. <tr>
  264. <td>&nbsp;</td>
  265. <td bgcolor="#FFFFCC"><font size="3" face="Arial"><b>For
  266. Target:</b> Use this list in </font><a
  267. href="TDragDrop.htm#OnProcessDropped"><font size="3"
  268. face="Arial"><b><i>OnProcessDropped</i></b></font></a><font
  269. size="3" face="Arial">, if you want to get the dropped
  270. files.</font><p><font size="3" face="Arial"><b>For
  271. Source:</b> Add the files to this list, that you want to
  272. drag&amp;drop, before calling </font><a href="#Execute"><font
  273. size="3" face="Arial"><b><i>Execute</i></b></font></a><font
  274. size="3" face="Arial">. Only if the pidl is available,
  275. the drag&amp;drop target can create a shortcut.</font></p>
  276. <p><font color="#FF0000" size="3" face="Arial"><strong>Attention:</strong></font><font
  277. size="3" face="Arial"> <em><strong>FileList</strong></em>
  278. is an instance of </font><a href="#TFileList_Info"><font
  279. size="3" face="Arial"><em><strong>TFileList</strong></em></font></a><font
  280. size="3" face="Arial">!</font></p>
  281. </td>
  282. </tr>
  283. <tr>
  284. <td>&nbsp;</td>
  285. <td>&nbsp;</td>
  286. </tr>
  287. <tr>
  288. <td>&nbsp;</td>
  289. <td bgcolor="#008080"><font color="#FFFFFF" size="5"
  290. face="Arial"><b>NeedValid </b></font><font
  291. color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>
  292. </tr>
  293. <tr>
  294. <td rowspan="2">&nbsp;</td>
  295. <td bgcolor="#FFFFCC"><font size="3" face="Arial">Here,
  296. you can determine, if the drag&amp;drop data must have a
  297. filename (set includes<b> </b><b><i>nvFilename</i></b>)
  298. or </font><a href="#pidl_Info"><font size="3"
  299. face="Arial">pidl</font></a><font size="3" face="Arial">
  300. (set includes <b><i>nvPIDL</i></b>). This property
  301. applies to receiving AND transmitting data.</font><p><font
  302. size="3" face="Arial"><b>For Source:</b> Only if the
  303. pidls are available, you can make a shortcut e.g. to the
  304. desktop! </font></p>
  305. </td>
  306. </tr>
  307. <tr>
  308. <td bgcolor="#FFFFEF">&nbsp;</td>
  309. </tr>
  310. <tr>
  311. <td>&nbsp;</td>
  312. <td bgcolor="#008080"><a name="ShellExtensions"><font
  313. color="#FFFFFF" size="5" face="Arial"><b>ShellExtensions</b></font></a><font
  314. color="#FFFFFF" size="5" face="Arial"><b> </b></font><font
  315. color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>
  316. </tr>
  317. <tr>
  318. <td>&nbsp;</td>
  319. <td bgcolor="#FFFFCC"><font size="3" face="Arial">This
  320. property has two sub-properties:</font><ul>
  321. <li><font size="3" face="Arial"><em><strong>DragDropHandler</strong></em></font></li>
  322. <li><font size="3" face="Arial"><em><strong>DropHandler</strong></em></font></li>
  323. </ul>
  324. <p><font size="3" face="Arial">If the user drops data
  325. with right mousebutton and the property </font><a
  326. href="TDragDrop.htm#TargetPopUpMenu"><font size="3"
  327. face="Arial"><em><strong>TargetPopUpMenu</strong></em></font></a><font
  328. size="3" face="Arial"> and the sub-property <em><strong>DragDropHandler
  329. </strong></em>is set to true, this component checks for a
  330. available drag&amp;drop-handler. For this you must
  331. specify a drop-target in the event-handler </font><a
  332. href="#OnSpecifyDropTarget"><font size="3" face="Arial"><em><strong>OnSpecifyDropTarget</strong></em></font></a><font
  333. size="3" face="Arial">. The drop-target must be a
  334. directory. If a drag&amp;drop-handler is available for
  335. the dropped data, there will be</font> <font face="Arial">corresponding
  336. items added to to context-menu. If the user e</font><font
  337. size="3" face="Arial">.g. drops ZIP-Files and Winzip is
  338. installed, items like &quot;Extract to ...&quot; will
  339. added to the context-menu. If the user selected such an
  340. item, the dropped files will be extracted and you are
  341. notified by the event </font><a
  342. href="TDragDrop.htm#OnMenuSucceeded"><font size="3"
  343. face="Arial"><em><strong>OnMenuSucceeded</strong></em></font></a><font
  344. size="3" face="Arial">, that the extension was
  345. successfully executed. Was the extension successfully
  346. executed, the events </font><a
  347. href="TDragDrop.htm#OnDrop"><font size="3" face="Arial"><em><strong>OnDrop</strong></em></font></a><font
  348. size="3" face="Arial"> and </font><a
  349. href="TDragDrop.htm#OnProcessDropped"><font size="3"
  350. face="Arial"><em><strong>OnProcessDropped</strong></em></font></a><font
  351. size="3" face="Arial"> won't be triggered.</font></p>
  352. <p><font size="3" face="Arial">If the user drops files on
  353. an other file and the sub-property <em><strong>DropHandler</strong></em>
  354. is set to true, the drop-handler will be executed, if
  355. available. The drop-handler will only executed, if you
  356. specify in the event </font><a
  357. href="#OnSpecifyDropTarget"><font size="3" face="Arial"><em><strong>OnSpecifyDropTarget</strong></em></font></a><font
  358. size="3" face="Arial"> a file, for that is a drop-handler
  359. defined in the registry. You can determine during a drop
  360. with the method </font><a href="#TargetHasDropHandler"><font
  361. size="3" face="Arial"><em><strong>TargetHasDropHandler</strong></em></font></a><font
  362. size="3" face="Arial"> in the event </font><a
  363. href="TDragDrop.htm#OnDragOver"><font size="3"
  364. face="Arial"><em><strong>OnDragOver</strong></em></font></a><font
  365. size="3" face="Arial">, if the file has a drop-handler.
  366. If the drop-handler was successfully executed, the event </font><a
  367. href="TDragDrop.htm#OnDropHandlerSucceeded"><font
  368. size="3" face="Arial"><em><strong>OnDropHandlerSucceeded</strong></em></font></a><font
  369. size="3" face="Arial"> will triggered. A drop-handler
  370. will be executed, if the user drops a file/directory on a
  371. ZIP-File and Winzip is installed. The dropped
  372. file/directory will be added to ZIP-file.</font></p>
  373. </td>
  374. </tr>
  375. <tr>
  376. <td>&nbsp;</td>
  377. <td height="50">&nbsp;</td>
  378. </tr>
  379. </table>
  380. <table border="0" width="600">
  381. <tr>
  382. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  383. <td rowspan="2" width="590"><font size="5" face="Arial">Events</font></td>
  384. </tr>
  385. <tr>
  386. <td>&nbsp;</td>
  387. </tr>
  388. </table>
  389. <table border="0" cellpadding="3" cellspacing="0" width="600">
  390. <tr>
  391. <td width="10">&nbsp;</td>
  392. <td bgcolor="#008080"><font color="#FFFFFF" size="5"
  393. face="Arial"><strong>inherited events</strong></font></td>
  394. </tr>
  395. <tr>
  396. <td rowspan="2">&nbsp;</td>
  397. <td bgcolor="#FFFFCC"><a href="TDragDrop.htm#Events"><font
  398. face="Arial">Click here ...</font></a></td>
  399. </tr>
  400. <tr>
  401. <td bgcolor="#FFFFEF">&nbsp;</td>
  402. </tr>
  403. <tr>
  404. <td>&nbsp;</td>
  405. <td bgcolor="#008080"><a name="OnSpecifyDropTarget"><font
  406. color="#FFFFFF" size="5" face="Arial"><strong>OnSpecifyDropTarget</strong></font></a><font
  407. color="#FFFFFF" size="5" face="Arial"><strong> </strong></font><font
  408. color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>
  409. </tr>
  410. <tr>
  411. <td>&nbsp;</td>
  412. <td bgcolor="#FFFFCC"><font size="3" face="Arial">This
  413. event will be triggered by the sub-properties of the
  414. property </font><a href="#ShellExtensions"><font size="3"
  415. face="Arial"><em><strong>ShellExtensions</strong></em></font></a><font
  416. size="3" face="Arial">. You must specify a drop-target
  417. (file/directory) by the filename or pidl. You don't need
  418. to specify both values, but it doesn't harm. If no
  419. drop-target is specified, the shell extensions won't be
  420. executed.</font></td>
  421. </tr>
  422. <tr>
  423. <td>&nbsp;</td>
  424. <td height="50">&nbsp;</td>
  425. </tr>
  426. </table>
  427. <table border="0" width="600">
  428. <tr>
  429. <td width="10" bgcolor="#008080" height="10">&nbsp;</td>
  430. <td rowspan="2" width="590"><font size="5" face="Arial">Methods</font></td>
  431. </tr>
  432. <tr>
  433. <td>&nbsp;</td>
  434. </tr>
  435. </table>
  436. <table border="0" cellpadding="3" cellspacing="0" width="600">
  437. <tr>
  438. <td width="10">&nbsp;</td>
  439. <td bgcolor="#008080"><font color="#FFFFFF" size="5"
  440. face="Arial"><strong>inherited methods</strong></font></td>
  441. </tr>
  442. <tr>
  443. <td rowspan="2">&nbsp;</td>
  444. <td bgcolor="#FFFFCC"><a href="TDragDrop.htm#Methods"><font
  445. face="Arial">Click here ...</font></a></td>
  446. </tr>
  447. <tr>
  448. <td bgcolor="#FFFFEF">&nbsp;</td>
  449. </tr>
  450. <tr>
  451. <td>&nbsp;</td>
  452. <td bgcolor="#008080"><a name="Execute"><font
  453. color="#FFFFFF" size="5" face="Arial"><b>Execute</b></font></a><font
  454. color="#FFFFFF" size="5" face="Arial"><b> </b></font><font
  455. color="#FFFF80" size="2" face="Arial"><b><i>public</i></b></font></td>
  456. </tr>
  457. <tr>
  458. <td rowspan="2">&nbsp;</td>
  459. <td bgcolor="#FFFFCC"><font size="3" face="Arial">Call
  460. this method, if you detect that the user wants to start a
  461. drag&amp;drop operation (e.g. MouseDown+MouseMove). Also
  462. look: </font><a href="#FileList"><font size="3"
  463. face="Arial"><em><strong>FileList</strong></em></font></a><font
  464. size="3" face="Arial">.</font><p><font size="3"
  465. face="Arial">For drag detection you can also use the
  466. inherited property </font><a
  467. href="TDragDrop.htm#AutoDetectDnD"><font size="3"
  468. face="Arial"><em><strong>AutotDetectDnD</strong></em></font></a><font
  469. size="3" face="Arial"> or the method </font><a
  470. href="TDragDrop.htm#StartDnDDetection"><font size="3"
  471. face="Arial"><em><strong>StartDnDDetection</strong></em></font></a><font
  472. size="3" face="Arial">.</font></p>
  473. <p><font color="#FF0000" size="3" face="Arial"><strong>IMPORTANT:</strong></font><font
  474. size="3" face="Arial"> If you use the drag-detection,
  475. it's high recommended to check the section &quot;</font><a
  476. href="TDragDrop.htm#DragDetectionProblem"><font size="3"
  477. face="Arial">Problems With The Drag-Detection</font></a><font
  478. size="3" face="Arial">&quot;.</font></p>
  479. </td>
  480. </tr>
  481. <tr>
  482. <td bgcolor="#FFFFEF">&nbsp;</td>
  483. </tr>
  484. <tr>
  485. <td>&nbsp;</td>
  486. <td bgcolor="#008080"><a name="TargetHasDropHandler"><font
  487. color="#FFFFFF" size="5" face="Arial"><b>TargetHasDropHandler</b></font></a><font
  488. color="#FFFFFF" size="5" face="Arial"><b> </b></font><font
  489. color="#FFFF80" size="2" face="Arial"><b><i>published</i></b></font></td>
  490. </tr>
  491. <tr>
  492. <td>&nbsp;</td>
  493. <td bgcolor="#FFFFCC"><font face="Arial">You can use this
  494. method to determine, if a drop-target (file) has a
  495. drop-handler or not. Normally, you will use this method
  496. in the event </font><a href="TDragDrop.htm#OnDragOver"><font
  497. size="3" face="Arial"><em><strong>OnDragOver</strong></em></font></a><font
  498. size="3" face="Arial"> to determine, if visual updates
  499. are necessary (e.g. selecting a file etc.).</font></td>
  500. </tr>
  501. <tr>
  502. <td>&nbsp;</td>
  503. <td height="50">&nbsp;</td>
  504. </tr>
  505. </table>
  506. <table border="0" width="600">
  507. <tr>
  508. <td width="10" bgcolor="#008080" height="10">&nbsp;</td>
  509. <td rowspan="2" colspan="2" width="590"><font size="5"
  510. face="Arial">How Do I Use It As Drag&amp;Drop Source</font></td>
  511. </tr>
  512. <tr>
  513. <td>&nbsp;</td>
  514. </tr>
  515. <tr>
  516. <td>&nbsp;</td>
  517. <td valign="top"><font face="Arial">1.</font></td>
  518. <td><font face="Arial">Drop a TWinControl on the form
  519. (e.g. a listbox).</font></td>
  520. </tr>
  521. <tr>
  522. <td>&nbsp;</td>
  523. <td valign="top"><font face="Arial">2.</font></td>
  524. <td><font face="Arial">Choose the TWinControl (listbox)
  525. in </font><a href="TDragDrop.htm#DragDropControl"><font
  526. face="Arial"><em><strong>DragDropControl</strong></em></font></a><font
  527. face="Arial">.</font></td>
  528. </tr>
  529. <tr>
  530. <td>&nbsp;</td>
  531. <td valign="top"><font face="Arial">3. </font></td>
  532. <td><font face="Arial">Choose the drag&amp;drop effects
  533. under </font><a href="TDragDrop.htm#SourceEffects"><font
  534. face="Arial"><em><strong>SourceEffects</strong></em></font></a><font
  535. face="Arial"> which the <em><strong>DragDropControl </strong></em>(listbox)
  536. should support. If you don't want any longer that the <em><strong>DragDropControl</strong></em>
  537. serve as drag&amp;drop source all items must be set to
  538. false.</font></td>
  539. </tr>
  540. <tr>
  541. <td>&nbsp;</td>
  542. <td valign="top"><font face="Arial">4.</font></td>
  543. <td><font face="Arial">Now, your <em><strong>DragDropControl</strong></em>
  544. (listbox) must detect, if the user wants to start a
  545. drag&amp;drop operation. You can use the event
  546. &quot;OnMouseDown&quot; of your <em><strong>DragDropControl</strong></em>
  547. (listbox). Add following to the event:</font><blockquote>
  548. <p><font face="Arial"><code>DragDropFiles1.FileList.AddItem(&lt;absolute
  549. pidl of file, if available, or nil&gt;, &lt;selected
  550. item in </code></font><a
  551. href="TDragDrop.htm#DragDropControl"><font
  552. face="Arial"><code><em><strong>DragDropControl</strong></em></code></font></a><font
  553. face="Arial"><code> (listbox)&gt;);</code></font></p>
  554. </blockquote>
  555. <p><font face="Arial">You must add the filenames
  556. including the WHOLE PATH!!!</font></p>
  557. </td>
  558. </tr>
  559. <tr>
  560. <td>&nbsp;</td>
  561. <td valign="top"><font face="Arial">5.</font></td>
  562. <td valign="top"><font face="Arial">Tell Windows that
  563. there is a drag&amp;drop operation to handle: Just call
  564. the method </font><a href="TDragDrop.htm#Execute"><font
  565. face="Arial"><em><strong>Execute</strong></em></font></a><font
  566. face="Arial"> of this component. </font></td>
  567. </tr>
  568. <tr>
  569. <td valign="top">&nbsp;</td>
  570. <td valign="top"><font face="Arial">6.</font></td>
  571. <td valign="top"><font size="3" face="Arial">You may use
  572. the events </font><a href="TDragDrop.htm#OnGiveFeedback"><font
  573. size="3" face="Arial"><b><i>OnGiveFeedback</i></b></font></a><font
  574. size="3" face="Arial"> and </font><a
  575. href="TDragDrop.htm#OnQueryContinueDrag"><font size="3"
  576. face="Arial"><b><i>OnQueryContinueDrag</i></b></font></a><font
  577. size="3" face="Arial">, but often you need not.</font></td>
  578. </tr>
  579. <tr>
  580. <td valign="top">&nbsp;</td>
  581. <td valign="top">&nbsp;</td>
  582. <td valign="top">&nbsp;</td>
  583. </tr>
  584. <tr>
  585. <td valign="top">&nbsp;</td>
  586. <td valign="top" colspan="2"><font face="Arial"><strong>Hints:</strong></font></td>
  587. </tr>
  588. <tr>
  589. <td valign="top">&nbsp;</td>
  590. <td valign="top" colspan="2"><ul>
  591. <li><font size="3" face="Arial">Drag&amp;drop
  592. operations cannot be done at design-time!</font></li>
  593. <li><font size="3" face="Arial">IMPORTANT: If you use
  594. the drag-detection, it's high recommended to
  595. check the section &quot;</font><a
  596. href="TDragDrop.htm#DragDetectionProblem"><font
  597. size="3" face="Arial">Problems With The
  598. Drag-Detection</font></a><font size="3"
  599. face="Arial">&quot;.</font></li>
  600. </ul>
  601. </td>
  602. </tr>
  603. <tr>
  604. <td height="50">&nbsp;</td>
  605. <td colspan="2">&nbsp;</td>
  606. </tr>
  607. </table>
  608. <table border="0" width="600">
  609. <tr>
  610. <td width="10" bgcolor="#008080" height="10">&nbsp;</td>
  611. <td rowspan="2" colspan="2" width="590"><font size="5"
  612. face="Arial">How Do I Use It As Drag&amp;Drop Target</font></td>
  613. </tr>
  614. <tr>
  615. <td>&nbsp;</td>
  616. </tr>
  617. <tr>
  618. <td>&nbsp;</td>
  619. <td valign="top"><font face="Arial">1.</font></td>
  620. <td><font face="Arial">Drop a TWinControl on the form
  621. (e.g. a listbox).</font></td>
  622. </tr>
  623. <tr>
  624. <td>&nbsp;</td>
  625. <td valign="top"><font face="Arial">2.</font></td>
  626. <td><font face="Arial">Choose the TWinControl (listbox)
  627. in </font><a href="TDragDrop.htm#DragDropControl"><font
  628. face="Arial"><em><strong>DragDropControl</strong></em></font></a><font
  629. face="Arial">.</font></td>
  630. </tr>
  631. <tr>
  632. <td>&nbsp;</td>
  633. <td valign="top"><font face="Arial">3. </font></td>
  634. <td><font face="Arial">Choose the drag&amp;drop effects
  635. under </font><a href="TDragDrop.htm#TargetEffects"><font
  636. face="Arial"><em><strong>TargetEffects</strong></em></font></a><font
  637. face="Arial"> which the <em><strong>DragDropControl </strong></em>(listbox)
  638. should support. If you don't want any longer that the <em><strong>DragDropControl</strong></em>
  639. serve as drag&amp;drop target all items must be set to
  640. false.</font></td>
  641. </tr>
  642. <tr>
  643. <td>&nbsp;</td>
  644. <td valign="top"><font face="Arial">4.</font></td>
  645. <td><font size="3" face="Arial">Now, you have to program
  646. what happen, if the user drops files on your </font><a
  647. href="TDragDrop.htm#DragDropControl"><font size="3"
  648. face="Arial"><b><i>DragDropControl</i></b></font></a><font
  649. size="3" face="Arial"> (listbox). For this, the best is
  650. to use the event </font><a
  651. href="TDragDrop.htm#OnProcessDropped"><font size="3"
  652. face="Arial"><b><i>OnProcessDropped</i></b></font></a><font
  653. size="3" face="Arial">. At first, you should check what
  654. drag&amp;drop effect was chosen by the user. You get the
  655. effect from method's parameter <b><i>dwEffect</i></b>.
  656. You get the files from this component with following
  657. line:</font><blockquote>
  658. <p><font size="3" face="Arial"><code>...
  659. :=DragDropFiles1.FileList[&lt;Index&gt;]^.Name; <br>
  660. </code></font><font color="#000080" size="3"
  661. face="Arial"><code><strong><i>// returns the
  662. filename; if not available, the result is an empty
  663. string</i></strong></code></font><font size="3"
  664. face="Arial"><code><strong><br>
  665. </strong></code><code>...
  666. :=DragDropFiles1.FileList[&lt;Index&gt;]^.pidlFQ; <br>
  667. </code></font><font color="#000080" size="3"
  668. face="Arial"><code><strong><i>// returns the pidl; if
  669. not available, the result is nil</i></strong></code></font></p>
  670. </blockquote>
  671. <p><a href="#FileList"><font size="3" face="Arial"><b><i>FileList</i></b></font></a><font
  672. size="3" face="Arial"> is an instance of </font><a
  673. href="#TFileList_Info"><font size="3" face="Arial"><em><strong>TFileList</strong></em></font></a><font
  674. size="3" face="Arial">. For more info check </font><a
  675. href="#TFileList_Info"><font size="3" face="Arial">below</font></a><font
  676. size="3" face="Arial">. Now, do with the files what you
  677. have to do, e.g. copy, move, delete, etc.</font></p>
  678. </td>
  679. </tr>
  680. <tr>
  681. <td>&nbsp;</td>
  682. <td valign="top"><font face="Arial">5.</font></td>
  683. <td valign="top"><font size="3" face="Arial">You may use
  684. the events </font><a href="TDragDrop.htm#OnDragEnter"><font
  685. size="3" face="Arial"><b><i>OnDragEnter</i></b></font></a><font
  686. size="3" face="Arial">, </font><a
  687. href="TDragDrop.htm#OnDragOver"><font size="3"
  688. face="Arial"><b><i>OnDragOver</i></b></font></a><font
  689. size="3" face="Arial"> and </font><a
  690. href="TDragDrop.htm#OnDragLeave"><font size="3"
  691. face="Arial"><b><i>OnDragLeave</i></b></font></a><font
  692. size="3" face="Arial">, but often you need not.</font></td>
  693. </tr>
  694. <tr>
  695. <td valign="top">&nbsp;</td>
  696. <td valign="top">&nbsp;</td>
  697. <td valign="top">&nbsp;</td>
  698. </tr>
  699. <tr>
  700. <td valign="top">&nbsp;</td>
  701. <td valign="top" colspan="2"><font face="Arial"><strong>Hints:</strong></font></td>
  702. </tr>
  703. <tr>
  704. <td valign="top">&nbsp;</td>
  705. <td valign="top" colspan="2"><ul>
  706. <li><font size="3" face="Arial">Drag&amp;drop
  707. operations cannot be done at design-time!</font></li>
  708. </ul>
  709. </td>
  710. </tr>
  711. <tr>
  712. <td height="50">&nbsp;</td>
  713. <td colspan="2">&nbsp;</td>
  714. </tr>
  715. </table>
  716. <table border="0" width="600">
  717. <tr>
  718. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  719. <td rowspan="2" width="590"><a name="TFileList_Info"><font
  720. size="5" face="Arial">Details about <strong>TFileList</strong></font></a></td>
  721. </tr>
  722. <tr>
  723. <td>&nbsp;</td>
  724. </tr>
  725. <tr>
  726. <td>&nbsp;</td>
  727. <td><font size="3" face="Arial"><b><i>TFileList</i></b>
  728. is a child of <b><i>TList</i></b>. Therefore, I don't
  729. explain the list, again. You can find a documentation in
  730. the online-help. Now, the new features of <b><i>TFileList</i></b>:</font><p><font
  731. size="3" face="Arial">You add items to the list with the
  732. function <b><i>AddItem</i></b> (or <b><i>AddItemEx</i></b>,
  733. if you want to use mapped filenames). The function make
  734. itself a copy of the pidl (absolute needed!) to relieve
  735. you of this dirty job. If you don't know the pidl, set
  736. the parameter to nil. If you don't know or have the
  737. filename (including the whole path), set this parameter
  738. to a emtpy string.</font></p>
  739. <p><font size="3" face="Arial">You can delete items or
  740. clear as common to lists. You needn't care about
  741. releasing resources - the <b><i>TFileList</i></b> cares
  742. about itself!</font></p>
  743. <p><font size="3" face="Arial">Besides, there are the
  744. functions <b><i>RenderPIDLs</i></b> and <b><i>RenderNames</i></b>.
  745. <b><i>RenderPIDLs</i></b> tries to get the according
  746. pidls to the filenames in the list. <b><i>RenderNames</i></b>
  747. tries to get the according filenames (including full
  748. path) to the pidls in the list. If the functions succeed
  749. the result is true else false. You need not to call them
  750. before a drag&amp;drop operation. This will be
  751. automaticly done by the component itself, if you set the
  752. property <b><i>CompleteFileList</i></b> to true. But it
  753. may be useful to call them after receiving data to
  754. complete the list. </font></p>
  755. </td>
  756. </tr>
  757. <tr>
  758. <td height="50">&nbsp;</td>
  759. <td>&nbsp;</td>
  760. </tr>
  761. </table>
  762. <table border="0" width="600">
  763. <tr>
  764. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  765. <td rowspan="2" width="590"><a name="pidl_Info"><font
  766. size="5" face="Arial">Details about <strong>PIDL</strong>s</font></a></td>
  767. </tr>
  768. <tr>
  769. <td>&nbsp;</td>
  770. </tr>
  771. <tr>
  772. <td>&nbsp;</td>
  773. <td><font size="3" face="Arial">Since Win95 the
  774. file-system is more difficult. It is object orientated
  775. and is named &quot;namespace&quot;. Every file, folder,
  776. etc. is an object in the object-tree of the namespace.
  777. Every object is an instance of the class <b><i>IShellFolder</i></b>
  778. (more info in the online-help). If you have the instance
  779. of the object, you can many do. E.g. you can determine
  780. the properties (attributes) of the object (is it a file?,
  781. is it a folder?, can I copy it?, ...). Every object can
  782. be identified by an ID: the <b><i>pidl</i></b>. By the
  783. pidl you can determine the IShellFolder-instance (use the
  784. enclosed unit &quot;pidl&quot;; description only in the
  785. code available).</font><p><font size="3" face="Arial">Pay
  786. attention about relative and absolute pidls. The instance
  787. itself has only a relative pidl (sometimes named as
  788. &quot;item pidl&quot;). The path of concatenated pidls
  789. from the root-object (desktop) to the child-object is the
  790. absolute pidl! Pay attentions about this difference. You
  791. can quickly fooled!</font></p>
  792. <p><font size="3" face="Arial">Very important: Shortscuts
  793. are only possible, if the pidl is available.</font></p>
  794. </td>
  795. </tr>
  796. <tr>
  797. <td height="50">&nbsp;</td>
  798. <td>&nbsp;</td>
  799. </tr>
  800. </table>
  801. <table border="0" width="600">
  802. <tr>
  803. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  804. <td rowspan="2" width="590"><font size="5" face="Arial">Details
  805. about <strong>mapped filenames</strong></font></td>
  806. </tr>
  807. <tr>
  808. <td>&nbsp;</td>
  809. </tr>
  810. <tr>
  811. <td>&nbsp;</td>
  812. <td><font size="3" face="Arial">If a mapped filename is
  813. set, the source inform you, that you have to rename the
  814. received name into the mapped name after to
  815. d&amp;d-operation. The mapped filenames are used, if you
  816. drag files from the &quot;RecycleBin&quot;.</font></td>
  817. </tr>
  818. <tr>
  819. <td height="50">&nbsp;</td>
  820. <td>&nbsp;</td>
  821. </tr>
  822. </table>
  823. <table border="0" width="600">
  824. <tr>
  825. <td width="10" bgcolor="#008080" height="10">&nbsp;</td>
  826. <td rowspan="2" width="590"><font size="5" face="Arial">FAQ</font></td>
  827. </tr>
  828. <tr>
  829. <td>&nbsp;</td>
  830. </tr>
  831. <tr>
  832. <td>&nbsp;</td>
  833. <td><font size="3" face="Arial"><b>Q:</b> My application
  834. supports only some special file-formats. How can I forbid
  835. the other formats during the drop?</font><p><font
  836. size="3" face="Arial"><b>A:</b> Set the property </font><a
  837. href="TDragDrop.htm#RenderOn"><font size="3" face="Arial"><em><strong>RenderOn</strong></em></font></a><font
  838. size="3" face="Arial"> to <b><i>rdoDropEnterAndDropSync</i></b>
  839. and check out the </font><a href="#FileList"><font
  840. size="3" face="Arial"><em><strong>Filelist</strong></em></font></a><font
  841. size="3" face="Arial"> in the event </font><a
  842. href="TDragDrop.htm#OnDragEnter"><font size="3"
  843. face="Arial"><b><i>OnDragEnter</i></b></font></a><font
  844. size="3" face="Arial">. Set the parameter <em><strong>Accept</strong></em>
  845. in this event to true, if your application support the
  846. files in the <em><strong>Filelist</strong></em> otherwise
  847. set the parameter to false. If you only use the first
  848. file, check only the first item in the <em><strong>Filelist</strong></em>.</font></p>
  849. </td>
  850. </tr>
  851. <tr>
  852. <td height="50">&nbsp;</td>
  853. <td>&nbsp;</td>
  854. </tr>
  855. </table>
  856. <table border="0" width="600">
  857. <tr>
  858. <td width="10" bgcolor="#008080" height="10">&nbsp; </td>
  859. <td rowspan="2" width="590"><font size="5" face="Arial">Known
  860. Bugs</font></td>
  861. </tr>
  862. <tr>
  863. <td>&nbsp;</td>
  864. </tr>
  865. <tr>
  866. <td>&nbsp;</td>
  867. <td><ul>
  868. <li><font size="3" face="Arial">Shortcuts are only
  869. possible, if the pidl is available (not really a
  870. bug) </font></li>
  871. </ul>
  872. </td>
  873. </tr>
  874. <tr>
  875. <td height="50">&nbsp;</td>
  876. <td>&nbsp;</td>
  877. </tr>
  878. </table>
  879. <hr>
  880. <p><font size="3" face="Arial"><i>© 1998,99 by </i></font><a
  881. href="mailto:[email protected]"><font size="3" face="Arial"><i>Dieter
  882. Steinwedel</i></font></a><font size="3" face="Arial"> </font></p>
  883. <p><a href="Index.htm"><font face="Arial">Back</font></a><font
  884. face="Arial"> to index</font></p>
  885. </body>
  886. </html>