sasuser.fitness
.
sashelp.classes
.
work.a.a.scl
. When the
selection includes two or more entries, the data is provided in a
list in which each item is a character string that contains the four-level
entry name.
dragEnabled
or dropEnabled
attributes are set to “Yes.” If either of these attribute values is “Yes”, then:
dragInfo
or dropInfo
attribute values.
dragInfo
attribute's dataRepresentation and invokes the _addDragRep method to register each drag data representation that is supported by the object.
dropInfo
attribute's dataRepresentation and invokes the _addDropRep method to register each
drop data representation that is supported by the object.
dragOperations
and/or dropOperations
settings.
sashelp.classes.DragAndDrop.class
:
attributeName
and attributeValue
) on an instance of the Drag and Drop component before passing the object. The default
implementation of _getDragData
attributeName
is defined for the associated dragInfo data representation that was selected for
the drop
attributeName
attribute
attributeValue
attribute
attributeName
is specified as part of the dragInfo data representation, then you can override the _getDragData method to set the value of the drag and drop object's attributeValue
attribute.
attributeName
from the drop site's dropInfo
attribute based on the selected data representation
attributeName
using the attributeValue that was passed in the drag and drop object
attributeName
exists on the drop site, you can override the _drop method and implement the desired
drop behavior.
dragEnabled
dragInfo
and dragOperations
.
dragInfo
dragInfo
attribute is a list that includes a named item for each drag representation:
dropInfo
attribute.)
dragOperations
dropEnabled
Yes
is all
that is needed to implement a drop site using default values for dropInfo
and dropOperations
.
dropInfo
dropInfo
attribute is a list that includes a named item for each drop representation:
dragInfo
attribute. (The _setAttributeValue method is called on the drop site's attribute,
using the value of the attribute specified in the dragInfo
attribute.)
dropOperations
Override this method...
|
To...
|
---|---|
_startDrag
|
change the appearance or other state of the drag site when the drag begins. The code
that you add runs when the user begins dragging from
the drag site.
|
_respondToDragOnto
|
change the appearance or other state of the drop site as the dragged item passes over
it. For example, you could change the drop site's
color to indicate that a drop action is valid.
|
_respondToDragOff
|
change the appearance or other state of the drop site as the dragged item moves off
of the drop site. For example, you could change the
drop site back to its normal appearance if it was changed by _respondToDragOnto.
|
_getDragData
|
prepare the data that you want to pass to the drop site by setting attributes of the
drag and drop object that is passed between all drag and drop methods.
|
_validateDropData
|
perform any validation that you require before the drop action occurs. For example,
you can verify the range of data that is passed and then set the completeDrag attribute
of the drag and drop object to either “Yes” or “No” to indicate whether the drop can
occur. If completeDrag is
set to “No,” then the drop is cancelled, the _drop method does not run, and no attribute
values are set on the drop site.
|
_completeDrag
|
complete processing on the drag site. For example, consider two list boxes on a frame
that have the same data representation and a “Move” operation. When the item is dragged
from the first list box and dropped
onto the second, the “Move” operation indicates that the item should be removed from
the first list box. You can override _completeDrag to implement the “Move” operation
and delete the item from the drag
site.
Note: The _completeDrag method runs even if the drag and drop object's completeDrag
attribute is set to “No.” If necessary, check the value of this attribute before executing
the code.
|
_drop
|
process the drop action. This method executes only if the completeDrag attribute of
the drag and drop object is set to “Yes.” Typically, you override this method to perform
some action other than setting the appropriate attribute value
on the drop site. For example, you may want to display a message box that confirms
the success of
the drag and drop action.
|
sashelp.classes.DragAndDrop.class
). It provides a container for the standard drag and drop information that is passed
between a drag site and a drop site. The information is stored in the following attributes
of the Drag and Drop component:
sashelp.classes.type.class
, which contains the following attributes:
type | represents the type of the attribute value (Character, Numeric, List, Object). Based on the value of type, you can query the appropriate “value” attribute. |
characterValue | stores the character value if type is “Character.” |
listValue | stores the SCL list if type is “List.” |
numericValue | stores the numeric value if type is “Numeric.” |
objectValue | stores the object identifier if type is “Object.” |
drop: public method dndObj:input:object; if dndObj.attributeValue.type = 'Character' then do; /* Retrieve dndObj.attributeValue.characterValue, */ /* then add any other code. */ end; else if dndObj.attributeValue.type = 'Numeric' then do; /* Retrieve dndObj.attributeValue.numericValue, */ /* then add any other code. */ end; /* and so forth... */ endmethod;
dragOperations
attribute that is set on the drag site.
dragInfo
attribute that is set on the drag site
attributeValue
complex attribute of the Drag and Drop component. If one item is dragged, then the
data is stored in the characterValue
attribute of the attributeValue object. If two or more items are dragged, then the
data is stored in the listValue
attribute as separate character items.
sashelp.classes.ListBox_c.class
and whose description is Source List Box
.
Yes
.
sasuser.test.SourceListBox.class
.
sasuser.test.SourceListBox.scl
:USECLASS sasuser.test.SourceListBox.class; /* Override of the _completeDrag method */ completeDrag: method dndobj:sashelp.classes.draganddrop.class; dcl num rc; /* If the rep is one that is not understood, call super. */ if ( upcase(dndobj.dataRepresentation) = 'CHARACTERDATA' ) then do; /* Check the status of the completeDrag attribute. */ if ( ( upcase(dndobj.completeDrag) = 'YES' ) AND ( upcase(dndobj.dataOperation) = 'MOVE' ) ) then do; /* Remove the selected item from the items list. */ if (selectedIndex ^= 0 ) then do; /* Delete the item from the items attribute. */ rc = delitem(items, selectedIndex ); /* Set the items attribute equal to itself to */ /* update this list box. */ items = items; end; end; end; else _super( dndobj ); endmethod; enduseclass;
sashelp.classes.ListBox_c.class
and whose description is Target List Box
.
Yes
.
CHARACTERDATA
.
sasuser.test.TargetListBox.class
.
sasuser.test.TargetListBox.scl
:USECLASS sasuser.test.TargetListBox.class; /* Override of the _validateDropData method */ validateDropData: method dndobj:sashelp.classes.draganddrop.class; /* If the rep is one that is not understood, call super. */ if ( upcase(dndobj.dataRepresentation) = 'CHARACTERDATA' ) then do; /* Ensure that the type is 'Character' and that the */ /* value is not blank. If either of these checks */ /* fail, then do not let the drop happen. */ if ( ( upcase(dndobj.attributeValue.type) ^= 'CHARACTER' ) OR ^length( dndobj.attributeValue.characterValue ) ) then dndobj.completeDrag = 'No'; end; else _super( dndobj ); endmethod; /* Override of the _drop method */ drop: method dndobj:sashelp.classes.draganddrop.class; dcl num rc; /* If the rep is one that is not understood, call super. */ if ( upcase(dndobj.dataRepresentation) = 'CHARACTERDATA' ) then do; /* Ensure that the attributeValue is the correct type. */ /* If so, then insert it at the end of the items list. */ if ( upcase(dndobj.attributeValue.type) = 'CHARACTER' ) then do; dcl num rc; rc = insertc( items,dndobj.attributeValue.characterValue, -1 ); /* Set the items attribute equal to itself in order to */ /* update this list box. */ items = items; end; end; else _super( dndobj ); endmethod; enduseclass;
sasuser.test.SourceListBox.class
and sasuser.test.TargetListBox.class
. If the Components
window is not displayed when the new frame appears in the Build window, then select ViewattributeValue
attribute that is passed in the drag and drop object and adds the value to its items
attribute. Finally,
the _completeDrag method on the Source List Box verifies that a drop
has successfully occurred by querying the completeDrag
attribute on the drag and drop object. It then removes the item
from the list of items displayed in the list box to complete the MOVE
action.