Drag and Drop Communication

Introduction

Drag and drop communication involves dragging components or objects with a mouse (or other pointing device) and dropping them over other objects at run time to perform an action.
A component that can be dragged is called a drag site, and a component that can receive the dragged object is called a drop site. The data that is transferred between the components is referred to as the dragInfo or the dropInfo.
For step-by-step information on setting drag and drop component communication, see “Enabling Drag and Drop Functionality” in the SAS/AF online Help.

Determining When to Use Drag and Drop Communication

Use drag and drop communication when
  • you want users to be able to transfer data from one component to another by interacting with a frame's components during application run time.
  • you cannot easily use attribute linking to transfer data from one component to another during application run time.
Drag and drop functionality varies between different operating systems, and some environments do not support it. If you develop an application that uses drag and drop communication, you may want to provide an alternative process so that the action can be performed in all environments.

Which Components Support Drag and Drop?

Most of the components in sashelp.fsp.AFComponents.resource have default drag and drop attribute settings. Exceptions include
  • Container Box control
  • Critical Success Factor control
  • Map control
If you want to change the default drag and drop attribute settings, use the Properties window.

Defining Drag and Drop Sites

Drag and drop sites can be defined for any component that is a subclass of the Frame class or the Widget class, including all visual controls.
In many cases, SAS has already defined components as drag and/or drop sites. You can use those components to perform drag and drop component communication without having to modify them.
To define a component to function as a drag site:
  1. Set the dragEnabled attribute to Yes if you want the component to work as a drag site by default. In most cases, setting this attribute is all you need to do to define a drag site.
  2. Specify a data representation and attribute to be passed for the drag site by setting the dragInfo attribute.
  3. Specify a drag and drop operation for the drag site by setting the dragOperations attribute.
To define a component to function as a drop site:
  1. Set the dropEnabled attribute to Yes if you want the component to work as a drop site by default. In most cases, setting this attribute is all you need to do to define a drop site.
  2. Specify a data representation and attribute to be passed for the drop site by setting the dropInfo attribute.
  3. Specify a drag and drop operation for the drop site by setting the dropOperations attribute.

Tips for Defining Drag and Drop Sites

When you define drag and drop sites, keep the following tips in mind:
  • Any subclass of the Widget or Frame class supports drag and drop component communication.
  • Data from one component can be dragged to another component.
  • The drop sites and drag sites do not need to reside in the same window.
  • Components can act as both drag sites and drop sites.
  • Drag sites cannot be dragged outside the SAS software environment unless they have a data representation of _DND_TXT.
  • Default drag and drop behavior may vary according to the host operating environment on which your application executes.

Example

Use drag and drop communication to cause a graph to appear when you drag a specific graph entry from a list box and drop it onto a Graph Output control.
  1. Create or open a FRAME entry.
  2. Place a List Box control and a Graph Output control on the frame.
  3. Drag and drop the Catalog Entry List model onto the List Box control.
  4. Use the Properties window to set the Catalog Entry List model's catalog attribute to the name of a catalog that contains graphic entries (for example, SASHELP.EISGRPH). (Optional) If you want the list box to show only one particular type of entry, set the Catalog Entry List model's typeFilter attribute to the appropriate entry type.
  5. Use the Properties window to set the Graph Output control's borderStyle attribute to Simple.
  6. Use the Properties window to set the List Box control's dragEnabled attribute to Yes and the Graph Output control's dropEnabled attribute to Yes.
  7. At run time, drag a graphic entry from the list box and drop it onto the Graph Output control. The selected graphic appears in the Graph Output control.