Is it possible to set the drop ID data differently depending on the drag signature that is applicable to the drag and drop action?
I would like the DROPID to contain some data when dragging to one list and different data when dragging to another list. In other words can I interrogate which dag and drop signature is in use at the point of calling SETDROPID()?
You can do all kinds of stuff to accomplish various goals with drag and drop, knowing that you can use multiple dragid and dropid per control and other techniques, but when the questions are so generic that they require someone to write you an example, it just means you get a “Yes”
I think there is enough info and example code in the help on DragID() DropID() SetDropID() for you to write a simple example/test and work out the right code. You can also search help for those (plus Event:Drag / Event:Drop) and find more help like " How to add Drag and Drop to a List Box"
This topic covers some:
Please make a small example and post it here to help others. This GIST has a “Scratch List” program filled from a Directory() of the Temp folder as a good start for making a test project.
Unfortunately there is no code example or anything in the manuals that I can see that sets the DROPID data based on the DROPID signature in use hence my question.
I have a ListBox with 2 DRAGID signatures, ‘Ticket’ and ‘Order’. When someone drags the data to the other listbox with the DROPID of ‘Order’ I want to fill out the SETDROPID with the ID of the order that is being dragged and when someone drags the data to the alternate list box with the DROPID of ‘Ticket’ I want to fill out the SETDROPID with the ID of the ticket that is being dragged.
I remembered I had a simple Drag and Drop in a Bitmap tool. I changed it to have 2 different Signatures: One for Decimal and One for Hex. I confirmed it worked as I described.
Debug confirms that Event:Drag comes first and in there based on DragID() set either Decimal or Hex in the SetDropID
OF EVENT:Drag
DID"=DRAGID(,Cn#) ; DB('EVENT:Drag Cn#='& Cn# &' DragID='& DID" &' CHOICE(?List:BmQ)=' & CHOICE(?List:BmQ) )
IF DRAGID() THEN
GET(BMQ, CHOICE(?List:BmQ))
CASE DRAGID() !What was Dropped on Decimal or Hex
OF 'DragBMQ_Decimal' ; SETDROPID( BMQ:DecBm )
OF 'DragBMQ_Hex' ; SETDROPID( BMQ:HexBm[1:4] & BMQ:HexBm[6:9] & 'h' )
ELSE ; SETDROPID('Unknown DragID=' & DragID())
END
DB('EVENT:Drag SETDROPID() = ' & DROPID() )
END
OF EVENT:Drop
DoD"=DROPID(,Cn#) ; DB('EVENT:Drop Cn#='& Cn# &' DROPID='& DoD" &' DRAGID()='& DRAGID() )
ChangeAndSelect(FIELD(), DROPID())
Debug shows I first drag and dropped on the top Value Entry that takes Decimal. Second I drag and dropped on the Operand that takes Hex. After the mouse release on the Drop control the first Event is Event:Drag where the DragID tells you the matching ID of the Drop so SetDropID() can be done. Next comes Event:Drop.