RasterEvent.accept( [position] )

Highlights the object under the mouse as a potential drop target. This method can be invoked in event objects capable of handling drag-and-drop operations such as RasterTreeEvent, RasterListEvent, and RasterTabbarEvent.

When a value is dragged over an item the control will issue an event with a type "over". In order for the item under the mouse to be highlighted as a potential drop target, the event handler must "accept" this event by invoking the accept() method.

If the event handler does not wishes to highlight the current item as a drop target, the accept() method should not be invoked.

The position property tells the event handler where the value being dragged is about to be dropped. This property may be one of the following values:

Position Value Description before Drop will happen before the given item. over Drop will happen over the given item. after Drop will happen after the given item.

The event handler may alter the default drop position by passing a new position to the accept() method. For example, if a list doesn't want to accept dragged values "over" any item, it can pass the argument "before" to the accept() method. This will make the drop target to render as an "insertion line" before the item instead of a "shaded box" over the item.
function myHandler( e )
   // do not accept drag values 'over' items,
   // only 'before' or 'after'
   if ( e.position=="over"  )
      e.accept( "before" ); //convert "over" to "before"
      e.accept(); //Accept the current position
If the "over" event is not accepted, the "drop" event will not fire on a item if the mouse button is released over the item.


Name Type   Description
position string optional Overwrites current position value. If this argument is not specified, the current position value is used. This argument is case-sensitive. Any value other than "over", "before", or "after" will evaluate as "over".

See Also

Home Examples Download License
Copyright © 2010-2017 Edwin R. López