Drag and Drop, Introduction

4D - Documentation   Français   English   German   4D Write, Command Theme List   4D Write, Command Alphabetical List   4D Write, Constant Theme List   Back   Previous   Next

version 2004


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 4th Dimension area.

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

Default drag and drop

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).

Configuring 4D objects for drag and drop

You can drag and drop data between 4D Write areas and 4th Dimension objects.

All types of 4th Dimension fields (except for BLOBs and subtables) and variables (except for BLOBs) 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 4th Dimension 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 4th Dimension area into 4D Write, only the entire contents of the object can be copied.

In 4th Dimension, if you want to drag and drop objects between a 4D Write area and a 4th Dimension 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.

Programmed management of 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 4th Dimension 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 4th Dimension DRAG AND DROP PROPERTIES command. 4th Dimension 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.


4D - Documentation   Français   English   German   4D Write, Command Theme List   4D Write, Command Alphabetical List   4D Write, Constant Theme List   Back   Previous   Next