I have three listboxes where I can drag and drop items back and forth.
Depending on some arbitrary logic, I want to disallow some drops. For example, let's say the lists contain integers and I want to disallow dropping "even" integers onto one of the lists.
I have attached the following events to the listboxes: OnDragInitialize, OnDragOver, OnDrop, and OnDragDropCompleted with handledEventsToo set to True.
-Inside OnDragInitialize I fill my payload object, create a dragvisual, and set e.AllowedEffects = "All". Do I need to set e.Handled here for anything?
-Inside OnDragOver, I query the payload object for "even" integers and update the dragvisual based on the result. For disallowed drops, I set e.AllowedEffects = "None". Is that what I'm supposed to be doing to indicate the drop is not currently allowed? Does doing that stop the "OnDrop" and "OnDragDropCompleted" events from firing if the user drops the object? Am I supposed to do anythign with e.Handled here?
-Inside OnDrop, I query the dragvisual to see if the object can be dropped (should I be querying e.AllowedEffects instead or will it only fire when allowed?) and then perform the appropriate actions to manage the lists if allowed. Should I do something with e.Handled here?
Basically, I'm a little cloudy on when/where to set e.AllowedEffects, and what I use e.Handled for and how those things affects downstream events. I've read the documents about the events but they don't have very much detail about the flow between them.
Depending on some arbitrary logic, I want to disallow some drops. For example, let's say the lists contain integers and I want to disallow dropping "even" integers onto one of the lists.
I have attached the following events to the listboxes: OnDragInitialize, OnDragOver, OnDrop, and OnDragDropCompleted with handledEventsToo set to True.
-Inside OnDragInitialize I fill my payload object, create a dragvisual, and set e.AllowedEffects = "All". Do I need to set e.Handled here for anything?
-Inside OnDragOver, I query the payload object for "even" integers and update the dragvisual based on the result. For disallowed drops, I set e.AllowedEffects = "None". Is that what I'm supposed to be doing to indicate the drop is not currently allowed? Does doing that stop the "OnDrop" and "OnDragDropCompleted" events from firing if the user drops the object? Am I supposed to do anythign with e.Handled here?
-Inside OnDrop, I query the dragvisual to see if the object can be dropped (should I be querying e.AllowedEffects instead or will it only fire when allowed?) and then perform the appropriate actions to manage the lists if allowed. Should I do something with e.Handled here?
Basically, I'm a little cloudy on when/where to set e.AllowedEffects, and what I use e.Handled for and how those things affects downstream events. I've read the documents about the events but they don't have very much detail about the flow between them.