udragdrop
The udragdrop
widget is a control that accepts input from another uDragDrop
, other Uniface applications, and from Microsoft Windows Explorer. It enables the user to transfer values or perform other actions
by dragging an object from one widget and dropping it on another.
Default Logical Widgets
Uniface provides the following logical widgets mapped to uDragDrop
:
- DragSource—logical widget for a drag-and-drop source. It sets source-specific properties such as
source=on
andsourcefeedback=icon
- DropTarget—logical widget for a drag-and-drop target. It sets target-specific properties such as
target=on
,targetfeedback=copy,move
, andtargethilite=halftone
.
Widget Properties
Technical Property Name |
UI Property Name |
Default Value |
Dynamic |
---|---|---|---|
3D |
Yes |
||
Attach |
Yes |
||
Backcolor |
Yes |
||
Bitmap |
Yes |
||
Label |
Yes |
||
Frame |
Yes |
||
ImgSize |
No |
||
ImageLabelAlign |
Yes |
||
LabelFont |
Yes |
||
ParentDraw |
Yes |
||
Source |
Yes |
||
SourceFeedBack |
Yes |
||
Target |
Yes |
||
TargetFeedBack |
Yes |
||
TargetHiLite |
Yes |
||
— |
Yes |
||
AttachMargin |
Yes |
||
PopupRect |
Yes |
Triggers
- trigger detail —can contain
ProcScript that:
- Prepares for a drag-and-drop operation. It is
fired when dragging starts, with $result set to
StartDrag
. A possible use for this would be to collect key fields of an occurrence. - Handles double-clicks on both source and
target. In this situation, $result is set to
DoubleClick
to differentiate it from aStartDrag
. (A drag operation does not start with a click, it only starts after the mouse has actually been moved.)
- Prepares for a drag-and-drop operation. It is
fired when dragging starts, with $result set to
- trigger valueChanged—use the valueChanged trigger for ProcScript that handles drop events in a drop target. When this trigger is fired, the field contains a Uniface list representing the object that was dropped onto it. Usually the first list item would be inspected to determine the class of the object, any other items could be used to identify the instance (for example, a primary key).
Grid and MSAA Support
Supported in Grid? | No |
Supports MSAA? : | No |
Description
The udragdrop
widget supports:
- Transferring
values between
udragdrop
widgets using a drag-and-drop metaphor. - Accepts
drops from other Uniface applications and from Microsoft Windows Explorer.
Note: If Uniface (ide.exe or uniface.exe) is run as administrator, it may not be possible to drag and drop from Windows Explorer to Uniface. This is because different security policies are applied in the source and target applications.
- Performing more complicated behavior by defining the valueChanged and detail triggers.
Note: Unlike the Tree and Picture widgets, which also support drag and drop behavior, the Drag-and-Drop widget does not use drag-and-drop formats.
In character mode, this widget is mapped to a Unifield.
Source and Target
A udragdrop
widget can be set to be a source,
a target, or both. However, an object cannot be dragged from a widget to the same widget; in other words,
releasing an object over its own source does not cause a drop event.
If Source is set to
TRUE
:
- The user can click the left mouse button on the widget and drag the contents onto another widget acting as a drag target.
- When dragging starts, the Detail trigger is fired with
$result set to
StartDrag
. - During dragging, the mouse pointer can have a variety of shapes, including a no entry sign when the pointer is not over a valid target.
If Target is set to
TRUE
:
- The user can drag an object from another
udragdrop
widget onto it. - When the mouse pointer is over the target and if the object being dragged matches an entry in the target’s ValRep definition, the mouse pointer changes from the no entry sign to something more appropriate.
- When the user releases the mouse button (and the object is acceptable) the contents of the source are copied to the target. The target then fires its valueChanged trigger.
For targets that accept both copy's and moves, $result should be inspected to determine the type of operation selected by the user.
When a drop target represents an action (for example, print, delete) rather than a container (for example, a directory or field list), it usually sets up its ValRep differently.
Objects can be dragged between different Uniface applications as long as the targets accept the objects held by the sources.
One or more files can be dragged from the
Microsoft Windows File Manager or Explorer to a drop target that includes file
(or
the wildcard) in its ValRep. The object that is dropped has file
in the first
item, and all selected file names (fully qualified) in the following list items.
You cannot start dragging by grabbing the label. Instead, you must grab the icon.
Data Content and ValRep Handling
The data that is transferred to or from the
udragdrop
widget consists of a Uniface list, in which the first item identifies the type of object held by
the widget, and the other list items are the instance variables (or primary key) of the object.
A ValRep list is used to control the inputs a DropTarget accepts. The first item of the contents is used to match with the ValRep definition. Other list items may be used to add data that is dragged and dropped together with the first item.
To display the second list item in the label associated with the widget, set the Label property. In this way, the icon reflects the type of object and the label identifies the instance. To start dragging, the user must click the icon, not the label.
When defining the ValRep of a udragdrop
widget, create an entry with a value of GOLD * to display any value of the field not individually
listed. Use the ValRep of the field to define the image displayed for each possible value
of this drag and drop widget.
If no ValRep has been defined, the current value
of the field is used as the image specification. In this case, you can also use the syntax
#
BlobName to specify the image.
Enter the desired image as
^
GlyphName or @
FileName.
Create an entry with a value of Gold * to define the image displayed for any value of the field not individually listed.
At runtime, the appearance of this drag and drop widget is defined by the list in $valrep or in $fieldvalrep, if the list has been defined.
For more information, see Images in ValRep Lists.