Both sides previous revisionPrevious revisionNext revision | Previous revision |
drag_and_drop_commands [2017/09/07 23:17] – [CS_GetDrgDst] cs_admin | drag_and_drop_commands [2017/09/07 23:30] (current) – [Receiving a drop from a non-CalendarSet Object] cs_admin |
---|
As well as dragging between two CalendarSet areas, you can also drag between non-CalendarSet objects and CalendarSet areas — for example, a row or cell selection from AreaList Pro, another 4D object, a text selection in any (drag and drop savvy) application window or a drop from an external document.
|
As well as dragging between two CalendarSet areas, you can also drag between non-CalendarSet objects and CalendarSet areas — for example, a row or cell selection from AreaList Pro, another 4D object, a text selection in any (drag and drop savvy) application window or a drop from an external document.
|
| |
Receiving a drop from an [[http://www.e-node.net/alp|AreaList Pro]] area is identified by [[Drag and Drop Command#CS_GetDrgSrcArea|CS_GetDrgSrcArea]] returning a negative value (opposite of the AreaList Pro area reference) in the **SourceArea** parameter and its process in **SourceProcessID**. | Receiving a drop from an [[http://www.e-node.net/alp|AreaList Pro]] area is identified by [[Drag_and_Drop_Commands#CS_GetDrgSrcArea|CS_GetDrgSrcArea]] returning a negative value (opposite of the AreaList Pro area reference) in the **SourceArea** parameter and its process in **SourceProcessID**. |
| |
If the source of the drag is an [[drag_and_drop_commands#What are access “codes”?|external object]], the callback (if set for the area) will be triggered twice: |
If the source of the drag is an [[drag_and_drop_commands#What are access “codes”?|external object]], the callback (if set for the area) will be triggered twice: |
After Allowing the drop from external objects in the callback, the **//CS_Action_Drop//** action or the **On Drop** event are used to open the document according to the pathname retrieved from the pasteboard, then process it. |
After Allowing the drop from external objects in the callback, the **//CS_Action_Drop//** action or the **On Drop** event are used to open the document according to the pathname retrieved from the pasteboard, then process it. |
| |
In the following example (available in the [[www.e-node.net/ftp/CalendarSet/CalendarSet_Demo_v13.zip|CalendarSet demonstration database]]) we import events from a XML document. We set the callback and allow drop from external documents in the CalendarSet area object method: | In the following example (available in the [[http://www.e-node.net/ftp/CalendarSet/CalendarSet_Demo_v13.zip|CalendarSet demonstration database]]) we import events from a XML document. We set the callback and allow drop from external documents in the CalendarSet area object method: |
| |
Case of
| Case of
|
| -> SrcCodeN | text | access code(s) to allow drag | | | -> SrcCodeN | text | access code(s) to allow drag | |
| |
**//CS_SetDrgSrc//** is used to enable dragging out of a CalendarSet source area, by setting the access codes for the source of the drag. Please read the section What are access “codes”? for more information. | **//CS_SetDrgSrc//** is used to enable dragging out of a CalendarSet source area, by setting the access codes for the source of the drag. Please read the section [[drag_and_drop_commands#What are access “codes”?|What are access “codes”?]] for more information. |
| |
This command must be called before a drag is initiated (usually in the **On load** form event processing). | This command must be called before a drag is initiated (usually in the **On load** form event processing). |
**SrcCode** — Text. The **SrcCode** can be any value (other than an empty string), such as “MonthDrag”, “WeekDrag”, “ALPDrag”, etc. | **SrcCode** — Text. The **SrcCode** can be any value (other than an empty string), such as “MonthDrag”, “WeekDrag”, “ALPDrag”, etc. |
| |
The code should be the same as what is passed into a potential drag partner. The drag partner will be the destination/receiver of the drag. That destination can be the same CalendarSet area, a different CalendarSet area, or an AreaList Pro area. | The code should be the same as what is passed into a potential drag partner. The drag partner will be the destination/receiver of the drag. That destination can be the same CalendarSet area, a different CalendarSet area, or an [[http://www.e-node.net/alp|AreaList Pro]] area. |
| |
CalendarSet performs the following logic when the drag and drop takes place: the source codes that were given in **SrcCode1**, **SrcCode2**, etc. are compared to the receiver's destination codes, previously set with **//CS_SetDrgDst//**. | CalendarSet performs the following logic when the drag and drop takes place: the source codes that were given in **SrcCode1**, **SrcCode2**, etc. are compared to the receiver's destination codes, previously set with [[Drag_and_Drop_Commands#CS_SetDrgDst|CS_SetDrgDst]]. |
| |
If any of the codes match, the drop is enabled. | If any of the codes match, the drop is enabled. |
|
|
In addition, any source access code will make a CalendarSet area draggable to external objects. | In addition, any source access code will make a CalendarSet area draggable to [[drag_and_drop_commands#What are access “codes”?|external object]]. |
| |
See the examples to **//CS_SetDrgDst//**. | See the examples to [[Drag_and_Drop_Commands#CS_SetDrgDst|CS_SetDrgDst]]. |
| |
<color #7092be>Note: events and banners, though set by the same **SourceDataType** value, behave a bit differently.</color> | <color #7092be>Note: events and banners, though set by the same **SourceDataType** value, behave a bit differently.</color> |
<color #7092be>To be draggable, both events and banners must be selectable (and a source access code must be present), but the default values differ:</color> |
<color #7092be>To be draggable, both events and banners must be selectable (and a source access code must be present), but the default values differ:</color> |
| |
* <color #7092be>Default for event: not selectable ($2 of CS_SetEventOpts) </color> | * <color #7092be>Default for event: not selectable ($2 of [[Configuring_Calendarset#CS_SetEventOpts|CS_SetEventOpts]] ) </color> |
| |
* <color #7092be>Default for banner: selectable ($2 of CS_SetBanrOpts) </color> | * <color #7092be>Default for banner: selectable ($2 of [[Configuring_Calendarset#CS_SetBanrOpts|CS_SetBanrOpts]] ) </color> |
| |
---- | ---- |