Satimage Previous | Next
Home Documentation Smile Custom GUI Developing your own custom dialog Handling drag-and-drop in a dialog drop  
When the user drags an item to one of the controls which accept drag-and-drop, the script of the recipient control receives a drop event.

You handle drop with a handler such as:
on drop the_quantity onto the_object at the_location
    -- handle the drop event
end drop
drop passes three parameters: the_quantity, a reference to the dragged item - possibly the result of an export from another object of Smile -, the_object, a reference to the control which is receiving the dragged item, and the_location, the relative coordinates of where the item was dropped.

When you drag an item from a List Box into itself the List Box' script receives export, but not drop.

drop will be called only if the dragged item belongs to a kind declared in the «class flav» list. For instance, the following script would handle dragging some text into a List Box: it will only if the «class flav» property of the List Box contains "TEXT".
on drop the_string onto the_object
    set the_list to contained data of the_object
    set contained data of the_object to the_list & the_string
end drop
By default, Smile keeps silent the execution errors that occur in a drop handler. If you want to be notified of execution errors that might occur in a drop handler, encapsulate the body of your handler within a try [...] on error [...] end try wrapper and handle the error.
Copyright ©2008 Paris, Satimage