Satimage Previous
export
Home Documentation Smile Custom GUI Developing your own custom dialog Handling drag-and-drop in a dialog export  
When the user drags from one of the controls which accept a mouse drag, the control's script receives an export event. It is required to provide an export handler: the result that export will return is the quantity that will be carried by the drag-and-drop, and that will be passed to the drop handler if dropping occurs in a control of a custom dialog of Smile.

You handle export with a handler such as:
on export the_object
    return some_quantity
end export
the_object contains a reference to the control which is exporting.
some_quantity is what the control will export.

The drag-and-drop will be effective only if the quantity returned by export belongs to a kind declared in the «class flav» list. For instance, the following script would handle dragging some text from the List Box: it will only if the «class flav» property of the List Box contains "TEXT".
on export the_list_box
    set the_list to contained data of the_list_box
    set the_index to item 1 of (get selection of the_list_box)
    set the_string to item the_index of the_list
    return the_string
end export
By default, Smile keeps silent the execution errors that occur in an export handler. If you want to be notified of execution errors that might occur in a export handler, encapsulate the body of your handler within a try [...] on error [...] end try wrapper and handle the error.
Copyright ©2008 Paris, Satimage