Drag and Drop - как использовать ItemAtPos для получения элемента DirListBox
Falk0ner, вс, 06/07/2008 - 15:34.
Drag and Drop - как использовать ItemAtPos для получения элемента DirListBox Просто сохраните результат функции ItematPos в переменной формы, и затем используйте эту переменную в обработчике ListBoxDragDrop. Пример:
FDragItem := ItematPos(X, Y, True);
if FDragItem >= 0 then
BeginDrag(false);
...
procedure TForm1.ListBoxDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if Source is TDirectoryListBox then
ListBox.Items.Add(TDirectoryListBox(Source).GetItemPath(FDragItem));
end;
if FDragItem >= 0 then
BeginDrag(false);
...
procedure TForm1.ListBoxDragDrop(Sender, Source: TObject; X, Y: Integer);
begin
if Source is TDirectoryListBox then
ListBox.Items.Add(TDirectoryListBox(Source).GetItemPath(FDragItem));
end;
http://delphiworld.narod.ru/ DelphiWorld 6.0
Отправить комментарий