Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Drag drop tiggering.. 1

Status
Not open for further replies.

EzLogic

Programmer
Aug 21, 2001
1,230
US
Container Class
Label
Image

Container has the auto drag/drop set to automatic (1)

on the form, it drags/drops the way it should.

however, only if the mouse is on the container, it drags/drops.

i want to allow user that, if they click and drag/drop while clicking anywhere inside the container (on the image or label) to trigger the container to move.. not the inside only.
i disabled the auto drag/drop for the image/label.

using: vfp9/sp2

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
I don't think you'll be able to do this with automatic drag and drop. What you need to do is set up the drag code in the container's MouseDown method. If the case where I'm doing something like this, I prefer OLE drag and drop (you have a lot more control than with the native), and so the code I have in the container's MouseDown is:

This.OLEDrag(.T.)

To get the contained objects to treat dragging as if it were on the container, you need to bind their MouseDown method to the container's MouseDown.

In my case, since there can actually be a hierarchy of objects inside the container, I have a method called BindMouseDown that's called at Init and contains this code:

LPARAMETERS oContainer

* Bind all contents to start drag
FOR EACH oObject IN oContainer.Objects FOXOBJECT
IF PEMSTATUS(oObject, "MouseDown", 5)
BINDEVENT(oObject, "MouseDown", This, "MouseDown")
ENDIF

IF PEMSTATUS(oObject, "Objects", 5)
This.BindMouseDown(m.oObject)
ENDIF
ENDFOR

In Init, I call the method like this:

This.BindMouseDown(This)

Tamar
 
worked like a charm.

Star for you! much appreciated!

Ali Koumaiha
TeknoSoft Inc.
Michigan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top