Subject:
|
Re: LDD vs LDraw
|
Newsgroups:
|
lugnet.cad
|
Date:
|
Thu, 14 Dec 2006 22:03:59 GMT
|
Viewed:
|
2472 times
|
| |
| |
Don Heyse wrote:
>
> Could you point me to the documentation on the ldlist drag and drop
> protocol? I forget where I last saw it.
I think this excerpt from a mail between me and someone else is the only
written documentation:
-8<--------- BEGIN ------------------------------------------------
I capture the mouse on a drag operation in LDLIST, and sends the following
message to each window the cursor passes (once every time the underlying
window changes):
(cds is a WM_COPYDATA structure)
cds.dwData := 0;
cds.cbData := 0;
cds.lpData := nil;
Response := SendMessage(h, WM_COPYDATA, Handle, longint(@cds));
and I expect a Response = 1 if the window accepts drops, 0 otherwise
(default if the message itself is not handled). In Delphi this is achieved
by setting Message.Result := 1; before exiting the message routine.
This is used to change the dragging cursor.
When a drop is performed, I send the following message:
cds.dwData := 1;
cds.cbData := SizeOf(CopyRecord);
cds.lpData := @CopyRecord;
SendMessage(h, WM_COPYDATA, Handle, longint(@cds));
If you want, you can acknowledge the drop in the same way as above (or
perhaps an error number if the sent string doesn't make any sense to your
program), but as you see, for the moment I ignore the return code.
The CopyRecord is defined as:
type
TCopyRecord = record
X, Y: integer;
(* this means 32-bit integers *)
s: packed array[0..255] of char;
(* This one is filled with a null-terminated string *)
end;
The record and CopyDataStruct that you receive in the message is filled and
sent in the following way:
CopyRecord.X := p.X;
CopyRecord.Y := p.Y;
StrPLCopy(CopyRecord.s, TheString, SizeOf(CopyRecord.s));
(* Making a null-terminated string, guaranteed not to overflow *)
The X and Y are screen coordinates, it's up to the receiver to convert to
window coordinates for the receiving window.
The string is of the format "6060.DAT Arch 1 x 6 x 3 & 1/3 with Curved
Top" (i.e. it looks exactly like the status panel in LDLIST). It's up to the
receiver to find this part in the LDRAW search hierarchy.
-8<--------- END --------------------------------------------------
--
Anders Isaksson, Sweden
BlockCAD: http://web.telia.com/~u16122508/proglego.htm
Gallery: http://web.telia.com/~u16122508/gallery/index.htm
|
|
Message has 1 Reply: | | LDList Documentation (Was: LDD vs LDraw)
|
| Ah ha, it looks like all I missed was the return(1) to let LDList know the ldglite window accept drops. Since it seems to work now, I'd like to gather the scattered LDList documentation here and retitle this part of the thread so I can find it (...) (18 years ago, 20-Dec-06, to lugnet.cad, FTX)
|
Message is in Reply To:
| | Re: LDD vs LDraw
|
| (...) I forget too, but it looks like I didn't make any changes for the part count update. It's a pretty cool feature and I suspect it wouldn't be too hard to implement. And maybe I can make the cursor switch to a drop target as well. (It does it (...) (18 years ago, 14-Dec-06, to lugnet.cad)
|
33 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
This Message and its Replies on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|