Page 1 of 1

Disabling drag and drop

Posted: Tue Mar 29, 2011 6:00 am
by r_houdek
I'm wondering if there's a way to disable drag and drop for a tree. I find myself sometimes inadvertently dragging nodes and getting some unusual results (new nodes appear representing the C:\ directory when it's not a "filesystem" type tree).

I'm hopeful there's a single property that can be set to disable it versus intercepting the events and ignoring them.

Any help would be greatly appreciated.

Thanks,

Ritch

Re: Disabling drag and drop

Posted: Tue Mar 29, 2011 11:11 am
by wilstrand
Hi Ritch

As far as possible working with rTree mimics the way you work with other controls in LiveCode. Consequently to disable drag and drop you can trap the dragNodeStart message sent to an rTree control when the user initiates the drag, preventing the drag and drop from being executed.

Place a dragNodeStart handler in the script of the control that does not contain a pass control structure:

Code: Select all

on dragNodeStart -- in script of a rTree control or one of its owners
    -- do nothing, but trap the message to disable drag & drop.
 end dragNodeStart
All the best,

Mats

Re: Disabling drag and drop

Posted: Wed Mar 30, 2011 1:42 am
by r_houdek
Thanks so much. This works great!

Ritch