4D Write v14

Drag and Drop, Introduction

Home

 
4D Write v14
Drag and Drop, Introduction

Drag and Drop, Introduction  


 

 

4D Write lets you carry out drag-and-drop operations within the same 4D Write area, between two different 4D Write areas or between a 4D Write area and a 4D area.

Drag and drop can be used by default (standard mode) or programmed.

By default, 4D Write offers standard automatic handling of drag and drop, based on the moving or copying of text or pictures: a selection of text or a picture can be moved using the mouse.
When a picture is inserted in a 4D Write area using drag and drop, it is automatically pasted into the text.
Data are moved when the drag and drop is carried out within the same or between two 4D Write areas, i.e. they are removed from the original area. If you only want to copy the data, hold down the Ctrl (Windows) or Command (Mac OS) key during the operation.

With this type of drag and drop, no specific programming is required; you just need to apply the appropriate “Draggable” and “Droppable” properties when you want to drag and drop inside 4D forms (see below).

You can drag and drop data between 4D Write areas and 4D objects.
Except for BLOBs, all types of 4D fields and variables can be dropped into 4D Write areas and vice versa. They will be inserted automatically into the 4D Write area as text or pictures according to their original type.

Warning: To drag textual data from a 4D field or variable into a 4D Write area, you must hold down the Alt (Windows) or Option (Mac OS) key during the operation.
Keep in mind that it is not possible to drag and drop a selection of text from a 4D area into 4D Write, only the entire contents of the object can be copied. In the case of hierarchical lists, only the list reference is copied. To be able to work with the contents of the list, you must use the 4D drag and drop commands.

  • In 4D, if you want to drag and drop objects between a 4D Write area and a 4D object, the “Draggable” property has to be selected for each object that must be dragged and dropped.
  • If the 4D Write area is included in a form, the “Droppable” property has to be selected for the area if it must receive 4D objects or elements coming from other 4D Write areas.
    The “Draggable” property must be selected if the elements of the area will need to be dragged.
  • For external windows of 4D Write, drag and drop is enabled by default. You must use the WR SET AREA PROPERTY command to control drag and drop.

The default drag and drop of 4D Write lets you set up intuitive interfaces and in general contributes to better ergonomics.
However, in certain cases, you may want to customize these mechanisms, more particularly for:

  • Using drag and drop from other form objects (hierarchical lists, scrollable areas, etc.)
  • Controlling the effect of a drag and drop, for example when copying the dragged data to several different locations.

In this case, you must combine the commands for managing drag and drop in 4D with those of 4D Write.

First of all, you need to be sure that the On Drag Over and/or On Drop form events have been checked for the objects used.

You can set the drag and drop properties for the 4D Write area using the WR GET AREA PROPERTY and WR SET AREA PROPERTY commands.
If the 4D Write area is included in a form, you can use the On Drag Over and/or On Drop form events of the included area object; if it is an external window, you must manage the events specifically using the WR ON EVENT command.

If you want to control the type of 4D objects being moved precisely, you must use the 4D DRAG AND DROP PROPERTIES command. 4D commands let you carry out any type of action in response to a drag and drop.

In the case of a drag and drop between two 4D Write areas, you can find out the area from which the data have been dragged using the WR GET DRAG SOURCE command.

You can find out the area into which the 4D object has been dropped using the WR GET DROP TARGET command as well as the exact position of the insertion point when the object was dropped (WR GET DROP INFO command): area (header, footer, body) and location of cursor.

 
PROPERTIES 

Product: 4D Write
Theme: WR Drag and Drop

 
ARTICLE USAGE

4D Write Language ( 4D Write v11.6)
4D Write Language ( 4D Write v12)
4D Write Language ( 4D Write v14)
4D Write Language ( 4D v13)
4D Write Language ( 4D Write v14 R2)
4D Write Language ( 4D Write v14 R3)
4D Write Language ( 4D Write v14 R4)