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
TDragDropSession
object 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
TView
class contains fields and methods that provide the building blocks for MacApp's drag-and-drop support. Several subclasses ofTView
support 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
TEditText
view, 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. ATEditText
view can accept a drop that contains text data only.Note that MacApp "floats" a
TDialogTEView
object (see page 247) over aTEditText
or aTNumberText
view to perform data entry. It is really theTDialogTEView
view that handles dragging and dropping.- TTextListView. You can drag selected text from a
TTextListView
object to another view or application that accepts text, or to the desktop to create a text-clipping file. ATTextListView
view cannot accept dragged data. (Two parent classes ofTTextListView
, theTTextGridView
andTGridView
classes, contain most of the drag-and-drop support.)- TNumberText. Dragging and dropping for a
TNumberText
view is the same as for aTEditText
view, except that aTNumberText
view expects dropped text data to be numeric.- TPicture. You can drag a selected picture from a
TPicture
view to anotherTPicture
view, 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. ATPicture
view 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
TPicture
view.- TStaticText. You can drag text from a
TStaticText
view to any destination that accepts text data. ATStaticText
view does not normally accept drops.- TTEview, TDialogTEView. The
TTEView
class is MacApp's specialized text-editing class. TheTDialogTEView
class is a subclass ofTTEView
that "floats" over aTEditText
orTNumberText
view 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. ATTEView
orTDialogTEView
view can accept a drop that contains text data only.