This is a problem is of my own making, as the code for drag_n_drop was
moved from the host system to a component. As a result in the case of 2
or more allowed source tables, a process variable which contained a
pointer to the dropped record's source table was no longer accessible.
right now the code looks like this:
In the host
:(On Begin Drag Over)
Drag_n_Drop_Begin("Source_set";->[Source_Table])
// Source set is most often the selection set of a listbox
// source table is most often the source table for the listbox
:(On Drag Over)
$0:=Drag_n_Drop_Verify(Form Event;Allowed_to_Drop(_One or
_Many);->[allowed_table1_1...->[allowed_table_N]
// allows or fails drag over & drop
:(On Drop)
Drag_n_Drop_Verify(Form Event;Allowed_to_Drop(_One or
_Many);->[allowed_table1_1...->[allowed_table_N]
// Places dragged record(s) into current selection of allowed_Table
the Drag_n_Drop methods are all in a component.
Drag_n_Drop works as follows:
- Drag_n_Drop_Begin -- an IP set is created which holds the record(s)
being dragged.
- On Drag over, the table to which the set belongs** is compared
against the the allowed source table(s), and a long int is returned
allowing (0) or dis-allowing (-1) the drag over/Drop action.
- On Drop the IP set is used & cleared, and the dropped record(s) are
left in the current selection.
** I can do this due to code Ive written (is available as the component
'Setutl') which allows me to ask the question:
To which table does a specified set belong?
All of this works very well, when there is only 1 source table allowed.
As I have recently found, this breaks down when there are 2 or more
source tables allowed, as, Outside of the component, I do not know
which of the allowed tables the drag n drop belongs too.
After reading through the various replies, the simplest solution is to
return a pointer to source table of the drag n drop, or Nil so my new
code will look like this:
:(On Drag Over)
$0:=Drag_n_Drop_Verify(Allowed_to_Drop(_One or
_Many);->[allowed_table1_1...->[allowed_table_N])
// allows or fails drag over & drop
:(On Drop)
$Source_Table:=Drag_n_Drop_Process
if (Not(Nil($Source_Table)))
// do stuff
On Mon, 12 Aug 2019 17:12:50 -0600, Adam Bevan via 4D_Tech wrote:
> I throw the data i want dropped into an object for dragndrop. Then
> when i drop I know what iam getting as i include the table and record
> numbers. Where i dragged it from(process,form,object) are also
> included. Made my listbox drag an drop so much easier to handle and
> very generic.
>
> Sent from my iPhone
>
>> On Aug 12, 2019, at 3:06 PM, Chip Scheide via 4D_Tech
>> <[email protected]> wrote:
>>
>> I am dragging and dropping 1 or more records from 1 process onto a
>> listbox in a second process.
>>
>> I see that I can use the pasteboard to mange the data during this
>> action.
>>
>> However....(dragging 1 record)
>> I am looking at the data types returned by GET PASTEBOARD DATA TYPE
>> com.4d.private.pid & com.4d.private.Form.Object -- neither of these
>> makes much sense to me.
>>
>> By using GET PASTEBOARD DATA i get a blob which is either
>> 4 bytes (com.4d.private.pid)
>> or
>> 524 bytes (com.4d.private.object.form)
>>
>> I do not know what to do with either of these blocks of data... can
>> someone point me in the right direction.
>>
>> The drop area is allowed to accept data from 5 different tables.
>> I need to be able to differentiate which table the data is from, &
>> which record(s) were dropped.
>>
>> Once I have which ever of the above data types hand, what do I do with
>> them to extract the needed information.
>>
>> Thanks
>> Chip
>>
>> ---------------
>> Gas is for washing parts
>> Alcohol is for drinkin'
>> Nitromethane is for racing
>> **********************************************************************
>> 4D Internet Users Group (4D iNUG)
>> Archive: http://lists.4d.com/archives.html
>> Options: https://lists.4d.com/mailman/options/4d_tech
>> Unsub: mailto:[email protected]
>> **********************************************************************
> **********************************************************************
> 4D Internet Users Group (4D iNUG)
> Archive: http://lists.4d.com/archives.html
> Options: https://lists.4d.com/mailman/options/4d_tech
> Unsub: mailto:[email protected]
> **********************************************************************
---------------
Gas is for washing parts
Alcohol is for drinkin'
Nitromethane is for racing
**********************************************************************
4D Internet Users Group (4D iNUG)
Archive: http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub: mailto:[email protected]
**********************************************************************