Package com.ms.awt
 In this topic

*Methods

 

Packages   PreviousThis PackageNext
Package com.ms.awt   Previous This
Package
Next

 


Class WDragSession

public class WDragSession extends DragHelper implements 
            DragSession  
{
  // Methods
  public static void beginDrag(TransferSession session);
  public static void beginDrag(MetaObject data, int available);
  public static void beginDrag(MetaObject data, int available, int preferred);
  public static void beginDrag(DragSource source, MetaObject data,
        int available);
  public static void beginDrag(DragSource source, MetaObject data,
        int available, int preferred);
  public static void beginDrag(DragSource source, TransferSession session);
}

This class is an extension of the DragHelper class. It implements the drag-and-drop APIs presented in the com.ms.object and com.ms.object.dragdrop Java packages for AWT objects. The dragdrop APIs work for both AWT and Microsoft AFC, but are implemented slightly different. The following example shows how you can implement drag-and-drop functionality using AWT and a WDragSession object.


import java.awt.*;
import com.ms.object.*;
import com.ms.object.dragdrop.*;
import com.ms.awt.WDragSession;

class DragMeAWT extends Canvas
{
//...
    public boolean mouseDown(Event e, int x, int y)
    {
        ObjectBag data = new ObjectBag();
        data.addObject(null, null, Color.red);
        WDragSession.beginDrag(data, Transfer.COPY | Transfer.LINK);

        return true;
    }
}

The same functionality is achieved with the UIDragDrop class when you use AFC.


import com.ms.ui.*;
import com.ms.object.*;
import com.ms.object.dragdrop.*;
import java.awt.Color;

class DragMeAFC extends UICanvas
{
//...
    public boolean mouseDown(Event e, int x, int y)
    {
        ObjectBag data = new ObjectBag();
        data.addObject(null, null, Color.red);
        UIDragDrop.beginDrag(data, Transfer.COPY | Transfer.LINK);

        return true;
    }
}

Use the beginDrag methods to start a drag-and-drop operation. All beginDrag methods act on two parameters, a DragSource object, and a TransferSession. Several of the beginDrag methods accept various TransferSession constructor parameters to simplify drag session creation.

DragHelper
  |
  +--WDragSession

Methods

beginDrag

public static void beginDrag(TransferSession session);

Starts a drag session by obtaining a TransferSession object and acting on it. The drag session has an undefined DragSource object. Drag-and-drop TransferSession implementations must support Transfer.MOVE.

Return Value:

No return value.

ParameterDescription
session The TransferSession object that is used during the current drag operation.

beginDrag

public static void beginDrag(MetaObject data, int available);

Starts a drag session by obtaining a TransferSession object and acting on it. The drag session has an undefined DragSource object. Drag-and-drop TransferSession implementations must support Transfer.MOVE.

Return Value:

No return value.

ParameterDescription
data A MetaObject used to create a TransferSession object. It is used in the current drag session.
available The transfer effects that are available for the created TransferSession. These include NONE, COPY, MOVE, and LINK.

beginDrag

public static void beginDrag(MetaObject data, int available, int preferred);

Starts a drag session by obtaining a TransferSession object and acting on it. The drag session has an undefined DragSource object. Drag-and-drop TransferSession implementations must support Transfer.MOVE.

Return Value:

No return value.

ParameterDescription
data A MetaObject used to create a TransferSession object. It is used in the current drag session.
available The transfer effects that are available for the created TransferSession. These include NONE, COPY, MOVE, and LINK.
preferred The preferred transfer effects for the current TransferSession.

beginDrag

public static void beginDrag(DragSource source, MetaObject data,
        int available);

Starts a drag session by obtaining a TransferSession object and acting on it. Drag-and-drop TransferSession implementations must support Transfer.MOVE.

Return Value:

No return value.

ParameterDescription
source A DragSource object that provides custom cursor behavior for the drag session.
data A MetaObject used to create a TransferSession object. It is used in the current drag session.
available The transfer effects that are available for the created TransferSession. These include NONE, COPY, MOVE, and LINK.

beginDrag

public static void beginDrag(DragSource source, MetaObject data,
        int available, int preferred);

Starts a drag session by obtaining a TransferSession object and acting on it. Drag-and-drop TransferSession implementations must support Transfer.MOVE.

Return Value:

No return value.

ParameterDescription
source A DragSource object that provides custom cursor behavior for the drag session.
data A MetaObject used to create a TransferSession object. It is used in the current drag session.
available The transfer effects that are available for the created TransferSession. These include NONE, COPY, MOVE, and LINK.
preferred The preferred transfer effects for the current TransferSession.

beginDrag

public static void beginDrag(DragSource source, TransferSession session);

Starts a drag session by obtaining a TransferSession object and acting on it. Drag-and-drop TransferSession implementations must support Transfer.MOVE.

Return Value:

No return value.

ParameterDescription
source A DragSource object that provides custom cursor behavior for the drag session.
session The TransferSession object that is used during the current drag operation.

upnrm.gif