space
Previous Page | Next Page

Communicating with Components

Drag and Drop Communication

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

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

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:


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.

space
Previous Page | Next Page | Top of Page