Drag and Drop in Smart Devices applicationsOfficial Content

This feature enables the end user to drag & drop elements in controls (Attribute, Image, Textblock, GridRow (grid's inside table), Table, Button, or any User Control). For example, users can drag a product from a grid to a shopping cart image in order to add it to the cart.

To implement the drag & drop feature in an SD application, the following events are used:

The Drag event is applied to the element that is going to be dragged, and the Drop event is applied to the possible targets. When dragging an element, the possible targets are all those that have an associated Drop event with the input parameter based on the same data type as the Drag output parameter. 

Note

When an element is dragged, it is no longer displayed in its original position. To have it displayed again, the Visible property must be set to True when dropping (in the DropAccepted event)..

Feedback during the Drag & Drop operation

When a drag & drop operation is made, the controls involved can change their appearance to give feedback to the user. To this end, we use the properties available within the Drag & Drop group of the Attribute, Image, Textblock, Grid, GridRow, Group and Table classes.

These properties are as follows:

  • StartDragging
    The class configured in this property is applied to the element when starting to Drag it.
  • AcceptDrag
    When an element accepts the Drag operation of the element that starts to be dragged, we use the class configured here to eventually suggest the user to drop this element.
  • NoAcceptDrag
    When an element accepts the Drag operation but the element being dragged is not of the expected type, we can indicate that the drop operation is not accepted over this element using the class configured here.
  • DragOver
    When an element accepts the Drag operation and the mouse is moving over this element, feedback can be provided by changing the class configured here.

Feature in action

Availability

This feature is available as of GeneXus X Evolution 2 Upgrade 4.
In Android only for version 4.0 or higher.

Sample