|
|
If your application uses text, graphic, or other data files, users expect that dropping a file icon on your icon will start your application working on that file. For example, dropping a text file on an editor's icon should start the editor with the text file open and ready to edit.
The following drop object script starts a text editor and passes to the editor the name of the file dropped on it. The system sets the variable $dynamic_args to the filename(s) represented by the dropped icon(s). (For more about Desktop variables, see the Graphical Environment Guide.)
begin shell -t 'Editor' vi $dynamic_args finishThe begin and finish statements cause the displayed icon to change from closed to activated, if you created the appropriate pixmap files.
Users can drop a group of icons on your application's icon. Consider how your application will handle this. For example, should the text editor open an editor window for each icon dropped? Or should it open one file and place the others in a queue? If more than one approach could be useful, let users choose the default behavior.