Important: The information in this document is obsolete and should not be used for new development.
Overview
A MacApp application can drag and drop data within a view, between views, and between itself and other applications that support drag and drop of similar data types. MacApp's drag-and-drop support relies on the Macintosh Drag Manager. The Drag Manager is integrated into System 7.5 and later versions of the Macintosh Operating System. Releases of System 7 before version 7.5 require the addition of the Macintosh Drag and Drop extension.A global
TDragDropSessionobject manages communication with the Drag Manager during drag-and-drop operations. A view that supports dropping registers with its window, and the window registers with the global drag session object.MacApp's
TViewclass contains fields and methods that provide the building blocks for MacApp's drag-and-drop support. Several subclasses ofTViewsupport drag and drop for the data types they display:
Your application must enable dragging or dropping for these views as it does for view subclasses you define. For more information, see "Recipe--Turning on Drag-and-Drop Support for a View," beginning on page 610.
- TEditText. You can drag selected text to another location within a
TEditTextview, or to another view or application that accepts text. You can drag text to create a text-clipping file on the desktop or drag text to the Trash to delete the text. ATEditTextview can accept a drop that contains text data only.Note that MacApp "floats" a
TDialogTEViewobject (see page 247) over aTEditTextor aTNumberTextview to perform data entry. It is really theTDialogTEViewview that handles dragging and dropping.- TTextListView. You can drag selected text from a
TTextListViewobject to another view or application that accepts text, or to the desktop to create a text-clipping file. ATTextListViewview cannot accept dragged data. (Two parent classes ofTTextListView, theTTextGridViewandTGridViewclasses, contain most of the drag-and-drop support.)- TNumberText. Dragging and dropping for a
TNumberTextview is the same as for aTEditTextview, except that aTNumberTextview expects dropped text data to be numeric.- TPicture. You can drag a selected picture from a
TPictureview to anotherTPictureview, to another view that accepts'PICT'data, or to another application that accepts'PICT'data. You can drag a selected picture to create a picture-clipping file on the desktop, or drag a picture to the Trash to delete it. ATPictureview can accept a drop that contains'PICT'data only.To see picture dragging in action, open two "Views by Template" views in the DemoDialogs application and try dragging a picture between them, or to the Scrapbook, desktop, or Trash. You can also drop pictures from the Scrapbook or picture clippings from the desktop onto the
TPictureview.- TStaticText. You can drag text from a
TStaticTextview to any destination that accepts text data. ATStaticTextview does not normally accept drops.- TTEview, TDialogTEView. The
TTEViewclass is MacApp's specialized text-editing class. TheTDialogTEViewclass is a subclass ofTTEViewthat "floats" over aTEditTextorTNumberTextview within a dialog view to perform data entry. For objects based on these view classes, you can drag selected text within the view, or to another view or application that accepts text data. You can drag text to create a text-clipping file on the desktop or drag text to the Trash to delete the text. ATTEVieworTDialogTEViewview can accept a drop that contains text data only.