dragenter event propagate up

L

Lance Johnson

I have a textbox on my form and have its allowdrop property set to true. I
want to allow certain drag/drop types to be allowed. However, if it isn't
supported here, I'd like for this event to flow up. I've overridden the
OnDragEnter in my form, but the event is never happening. If I allowdrop on
a control, is there no way to have this propagate up other than to handle
the textbox1.DragEnter event. I'd rather not do this, but just have the
event flow up. This may not be possible or may even not seem logical, but
we have a need for this.

Lance Johnson
 
Y

Ying-Shen Yu[MSFT]

Hi Lance,

The DragEnter event will not propagate up to its parent control
automatically, and as I as I know we can not change this behavior. Handling
the DragEnter event in your form is a reasonable workaround for this issue,
another way I can think of is define a public method to invoke the
DragEnter event on your form then override the OnDragEnter method of your
control, check value the DragEnter event , if the value is null, then
invoke the DragEnter event of the form.
But the second way will add some dependency between the controls and the
form, I think the first way is better, why it is not suitable for your
scenario?



Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 
Y

Yan-Hong Huang[MSFT]

Hello Lance,

I just reviewed this thread. Do you have any more concerns on the 2 ways
that YinShen introduced? If you could post here with more background
information, we can understand the scenario better and work more closely on
it.

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
L

Lance Johnson

Well the reason I am looking for an alternative method will become clearer
with why we're doing what we do. Our application knows what types of file
extensions it can process. We have a built-in base control for viewing
documents of any sort. It doesn't actually display the document but it has
all the method calls etc. built-in including handling drag/drop of files.
Maybe currently somebody is viewing a text document. If they drag a pdf
onto it, we want it just to propagate up to the base document viewer code so
it'll handle it. Obviously we can handle the event for drag/drop and call
the appropriate function in the base document viewer, but we were hoping to
not need to do any extra work. But that doesn't appear to be the case.

Lance Johnson
 
Y

Ying-Shen Yu[MSFT]

Hi Lance,

Thanks for your reply.
In this case, I think we need wire the event handlers to the
drag_enter/drag_drop events, since the event will not be propogated to
parent control.
Generally it does not require much code to wire these events, if you feel
it is not easy for your scenario, could you let me know the detail about
the scenario?

Thanks!


Best regards,

Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top