realbasic-nug
[Top] [All Lists]

Re: DropObject in Listbox

To: REALbasic Network Users Group <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: DropObject in Listbox
From: George Clark <gaclark at sprynet dot com>
Date: Sat, 29 Jun 2002 13:17:35 -0400
On 6/29/02 12:27, Brandon McWhirter wrote:

> Hi everyone. I have been trying to get this DropObject event to work in the
> Listbox and Window but everytime I drag a file to either the window or
> listbox, it just bounces back. I am using RBfc1 and OS 10.1.5. I can't seem
> to find any settings such as "AcceptDrop" or anything along those lines. My
> script is below.

You need to assign 'me.acceptfiledrop <filetype>' in the open event of the
Listbox and/or window for each file type that you're prepared to handle. The
file types must be defined in the "File types..." dialog.
 
> Sub DropObject(obj as DragItem)
> dim f as folderitem
> if obj.destination IsA folderItem then

Get rid of the above line. AFAIK this is only meaningful if you're dragging
TO the Finder, not from it. (Get rid of the corresponding 'end if', too, of
course.) I tried your code with it in place and it just would not work at
all. Without it, it does.

>   If obj.folderItemAvailable then
>     Do
>       f = obj.folderItem
>       if f<>nil then
>         if f.exists then
>           listBox1.AddRow ""
>           listbox1.cell(listBox1.ListCount-1, 1) = f.absolutePath
>           listBox1.cell(listBox1.ListCount-1, 2) = GetLength(f)

..LastIndex is simpler (and cleaner) than 'ListIndex-1'

>           pushButton3.enabled = true
>         end if
>       end if
>       f = nil
>     Loop until not Obj.NextItem
>   end if
> end if
> End Sub
> 
> Any help?



George

-- 
George Clark - gaclark at sprynet dot com




<Prev in Thread] Current Thread [Next in Thread>