I have TRichViewEdit set up to be used as a Viewer only, ie: I have Read Only set to true and I hide the caret.
The problems I am having is that I now need to accept Drag & Drop but I can't because Read Only is True!
How can I detect that a File is over the RichEdit control and switch Read Only to False so it can accept it then turn it back on (True)?
I have also another problem closely related, the files I am trying to Drag & Drop are with the Extension - .NFO and .DIZ these are not opening at all so how can I somehow Register them? or make RichViewEdit view them once Dragged & Dropped? Is there something I must do using AcceptDrapDropFormats?
Many thanks, I hope you can help me
parad0x
Drag & Drop Problems - Need Advice
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Well, you can use OnOleDragEnter, OnOleDragLeave, OnOleDrop and OnChange events:
You may wish to disallow drag&drop from this editor, include rvoDisallowDrag in RichViewEdit1.Options.
Besides, take a look at this demo: http://www.trichview.com/forums/viewtopic.php?t=132
It's quite an advanced one, but may be it does what you need.
Code: Select all
procedure TForm3.RichViewEdit1OleDragEnter(Sender: TCustomRichView;
const DataObject: IDataObject; Shift: TShiftState; X, Y: Integer;
PossibleDropEffects: TRVOleDropEffects;
var DropEffect: TRVOleDropEffect);
begin
RichViewEdit1.ReadOnly := False;
end;
procedure TForm3.RichViewEdit1OleDragLeave(Sender: TObject);
begin
RichViewEdit1.ReadOnly := True;
end;
var Dropping: Boolean = False;
procedure TForm3.RichViewEdit1OleDrop(Sender: TCustomRichView;
const DataObject: IDataObject; Shift: TShiftState; X, Y: Integer;
PossibleDropEffects: TRVOleDropEffects; var DropEffect: TRVOleDropEffect;
var DoDefault: Boolean);
begin
if DropEffect<>rvdeNone then
Dropping := True
else
RichViewEdit1.ReadOnly := True;
end;
procedure TForm3.RichViewEdit1Change(Sender: TObject);
begin
if Dropping then begin
Dropping := False;
RichViewEdit1.ReadOnly := True;
end;
end;
Besides, take a look at this demo: http://www.trichview.com/forums/viewtopic.php?t=132
It's quite an advanced one, but may be it does what you need.
-
- Site Admin
- Posts: 17555
- Joined: Sat Aug 27, 2005 10:28 am
- Contact: