Some of the controls handle drag-and-drop: you can drop to the Bevel Button, to the Image Well or to the List Box, and you can drag items from the List Box. However, these features are controlled by a property shared by those controls: the «class flav» property. The control's «class flav» property, a list of 4-character strings, specifies what kind of objects (what "flavors") the control can accept or can export. Standard flavors include:
- "hfs ": a file reference (for exemple, an icon from Finder)
- "long": an integer
- "doub": a real number
- "alis": an alias
- "reco": a record
- "TEXT": a string
- "obj ": a reference to an object of Smile
To handle drag-and-drop in a control's script, you need to handle two specific events: drop and export.
- drop: when the user drags an item to one of those controls which accept drag-and-drop, the script of the control receives a drop event.
- export: when the user drags from one of those controls which accept a mouse drag, the control's script receives an export event to let it specify what quantity the drag is exporting.
|