View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004179 | JEDI VCL | 00 JVCL Components | public | 2007-07-13 08:37 | 2008-10-29 06:20 |
Reporter | Andrew Shkuropiy | Assigned To | obones | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | suspended | ||
Platform | win32 | OS | Windows | OS Version | XP SP2 |
Product Version | 3.30 | ||||
Target Version | Fixed in Version | ||||
Summary | 0004179: TJvRichEdit - is there any way to catch WM_DROPFILES message? | ||||
Description | i'm trying to use TJvRichEdit to catch pictures from Windows Explorer by dragging graphic files into rich text. I tried to use this API in TForm.OnCreate DragAcceptFiles(JvRichEdit1.Handle, True); to enable receiving of WM_DROPFILES notifications, that contains information about files dragged into RichEdit. After that I used message hook (TApplication.OnMessage) to catch message WM_DROPFILES adressed to JvRichEdit1.Handle, but it's not catching this message when I'm trying to dragdrop files from explorer. It's working on standard VCL TRichEdit, but it doesn't on TJvRichEdit. Maybe I need to set up some additional properties of TJvRichEdit? Can you advice something how to enable that messages? | ||||
Tags | No tags attached. | ||||
|
If you set all of the following properties to true, you won't get a WM_DROPFILES notification: * AllowInPlace * AllowObjects * OleDragDrop If you set one or more of these to false, it should work. Note that changing these values will recreate the rich edit controls window, so you have to call DragAcceptFiles again |
|
Thank you, it's working if either AllowObjects or OleDragDrop set to false. But how to catch file's drag-drop if I need to display/operate OLE in TJvRichEdit? Is there any other way to catch drag-drop events from Windows Explorer on TJvRichEdit? |
|
Then you have to alter TRichEditOleCallback.QueryAcceptData; The following code is largely copied from JvDragDrop.pas: function TRichEditOleCallback.QueryAcceptData(const dataObj: IDataObject; var cfFormat: TClipFormat; reco: DWORD; fReally: BOOL; hMetaPict: HGLOBAL): HRESULT; var DragH: Integer; Medium: TStgMedium; Name: string; Count, Len: Integer; begin Result := S_OK; if dataObj.GetData(FileDropFormatEtc, Medium) = S_OK then try try if not fReally then begin Result := S_False; Exit; end; DragH := Integer(GlobalLock(Medium.hGlobal)); try Count := DragQueryFile(DragH, Cardinal(-1), nil, 0); if Count = 1 then begin Len := DragQueryFile(DragH, 0, nil, 0); if Len > 0 then begin SetLength(Name, Len + 1); DragQueryFile(DragH, 0, PChar(Name), Len + 1); SetLength(Name, Len); FRichEdit.Lines.LoadFromFile(Name); Result := S_False; Exit; end; end; finally GlobalUnlock(Medium.hGlobal); end; finally ReleaseStgMedium(Medium); end; except Result := E_FAIL; end; end; |
|
Thank you again! It works with such TFormatEtc record: var FileDropFormatEtc: TFormatEtc; begin ... FileDropFormatEtc.cfFormat := CF_HDROP; FileDropFormatEtc.ptd := nil; FileDropFormatEtc.dwAspect := DVASPECT_CONTENT; FileDropFormatEtc.lindex := 0; FileDropFormatEtc.tymed := TYMED_HGLOBAL; ... Don't you know, the developers of TJvRichEdit planned to extract some general OLEDragDrop events from IRichEditOLECallback interface in future versions of JVCL or not? (Something like TJvRichEdit.OnFileDrop, OnFileAccept etc) These events can greately extend possibilities of RichEdit, especially for novices (like me), who still don't know all fine points of IRichEditOleCallback. |
|
What should I do with this issue? |
|
Any news? |
|
No news, closing the issue. Please create a new one if this is still present in the latest SVN version. |
Date Modified | Username | Field | Change |
---|---|---|---|
2007-07-13 08:37 | Andrew Shkuropiy | New Issue | |
2007-07-16 13:25 | remkobonte | Note Added: 0013585 | |
2007-07-16 13:26 | remkobonte | Note Edited: 0013585 | |
2007-07-29 14:17 | Andrew Shkuropiy | Note Added: 0013605 | |
2007-08-08 16:38 | remkobonte | Note Added: 0013622 | |
2007-08-11 03:01 | Andrew Shkuropiy | Note Added: 0013625 | |
2007-10-12 08:17 | obones | Note Added: 0013929 | |
2007-10-12 08:17 | obones | Status | new => feedback |
2008-02-21 06:47 | obones | Note Added: 0014251 | |
2008-10-29 06:20 | obones | Status | feedback => resolved |
2008-10-29 06:20 | obones | Resolution | open => suspended |
2008-10-29 06:20 | obones | Assigned To | => obones |
2008-10-29 06:20 | obones | Note Added: 0014928 |