Re: Drag N Drop Woes

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Robert (noone_at_nowhere.com)
Date: 04/30/04


Date: Fri, 30 Apr 2004 09:11:47 +0200

Hi,

are you using the DragOver and DragDrop events? Take a look at the
OLEDrag... events, they offer a lot more functionality. That way you'll have
more control when to display which cursor, and you'll know from the
OLEDragCompleted event when a drag was completed (or canceled)

And what kinds of widgets do you have?

Robert

"Joseph Geretz" <jgeretz@nospam.com> wrote in message
news:ex1uVUYLEHA.1272@tk2msftngp13.phx.gbl...
> I haven't done a whole lot of drag and drop so maybe I'm missing something
> obvious.
>
> Let's say I have 25 widgets on my application form. That's not a lot.
Let's
> say also that one of these widgets is the source of a drag-n-drop, and one
> is a legitimate target onto which it can be dropped. The source widget is
in
> Manual mode. Starting the drag is no big deal. A module level variable
> tracks the mouse down state for the control (MouseDown, MouseUp); if a
> MouseMove event occurs while the mouse is down then SourceWidget.Drag
starts
> the drag operation.
>
> Starting the drag operation is no big deal. It's ending it which seems to
be
> a real pain. Although the application will only process the drop if
dropped
> on a particular TargetWidget, the user might drop the SourceWidget
anywhere
> on the screen. This means that in order to know when the user has
completed
> the drag, I need to implement every single DragDrop event handler for
every
> single widget on the form? This is a development / maintenance nightmare!
>
> And what about changing the icon? We start off with the default drag icon,
> but as the icon is dragged over it's drop zone, I'd like to morph the icon
> to indicate that it can be dropped here. OK, that's easy enough, simply
> replace the DragIcon in the DragOver event handler of the TargetWidget.
But
> now the user moves off the drop zone without dropping. Now I need to
change
> the icon back. So again, do I have to place code into the DragOver event
> handler of every widget on the form to make sure that the correct icon is
> showed while the object is dragged over that region? (Technically, I'd
only
> have to implement the handler for those widgets which border on the drop
> zone. But even this is not strictly true. Sometimes a quick mouse move
will
> traverse a small area without triggering a DragOver.) Again, a development
/
> maintenance nightmare!
>
> It gets worse. In this primitive example, I cited 25 widgets and one Drag
> source. In my scenario, we're more likely talking about three separate
drag
> sources, with 2 different icons for each, depending on whether the object
is
> over the drop zone or not. And between all frames, buttons, checkboxes,
text
> boxes, etc., I have a heck of a lot more than 25 widgets on this
particular
> form.
>
> Please tell me I'm missing something. It can't really be as cumbersome as
it
> seems. Can it?
>
> Please say it ain't so! Thanks for your help,
>
> - Joe Geretz -
>
>



Relevant Pages

  • Re: Drag N Drop Woes
    ... OLEDragCompleted event when a drag was completed ... > Let's say I have 25 widgets on my application form. ... We start off with the default drag icon, ... > replace the DragIcon in the DragOver event handler of the TargetWidget. ...
    (microsoft.public.vb.controls)
  • Re: Drag N Drop Woes
    ... OLEDragCompleted event when a drag was completed ... > Let's say I have 25 widgets on my application form. ... We start off with the default drag icon, ... > replace the DragIcon in the DragOver event handler of the TargetWidget. ...
    (microsoft.public.vb.winapi)
  • Drag N Drop Woes
    ... Let's say I have 25 widgets on my application form. ... Starting the drag is no big deal. ... We start off with the default drag icon, ... now the user moves off the drop zone without dropping. ...
    (microsoft.public.vb.controls)
  • Drag N Drop Woes
    ... Let's say I have 25 widgets on my application form. ... Starting the drag is no big deal. ... We start off with the default drag icon, ... now the user moves off the drop zone without dropping. ...
    (microsoft.public.vb.winapi)
  • Drag N Drop Woes
    ... Let's say I have 25 widgets on my application form. ... Starting the drag is no big deal. ... We start off with the default drag icon, ... now the user moves off the drop zone without dropping. ...
    (microsoft.public.vb.general.discussion)