15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Detecting drag-and-drop in CRichEditCtrl

Michael Iles -- michaeli@dra.com
Friday, September 13, 1996


Environment: NT 4.0, VC++ 4.2a beta

Hi,

I'm doing syntax colouring in a CRichEditCtrl and have everything working   
fine, except that I can't figure out how to be notified when the user   
drags-and-drops text within the control. The drag-and-drop functionality   
is provided with the rich edit control, and I've tried handling   
EN_CHANGE, EN_UPDATE, WM_LBUTTONUP, etc. to no avail.

Can anyone tell me how I can be notified that the user has   
dragged-and-dropped text so I can update the syntax colouring in my   
control?

Thanks,
Mike Iles
michaeli@dra.com




Ed Ball -- ed@logos.com
Tuesday, September 17, 1996


To detect drag-drops in a rich edit control, you must use the
CRichEditCtrl::SetOLECallback function. The CRichEditView class is a
good example on how to do this. You must put an "Interface Map" in your
class definition, just like the one in afxrich.h, and then provide
definitions for those member functions, as in viewrich.cpp. Just return
E_NOTIMPL for all of the callback functions that you don't use (assuming
you aren't implementing object linking and embedding, that'll be most of
them). The callbacks that will be called during a drag/drop operation
are GetDragDropEffect, QueryAcceptData, and GetClipboardData.
Incidentally, this is also the best way to implement a context menu --
provide one in the GetContextMenu callback.

- Ed
>




| Вернуться в корень Архива |