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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dragdrop tedious...

Status
Not open for further replies.

Gameboy9

Programmer
Jun 8, 2001
39
0
0
US
I'm trying to drag a container to anywhere in a form. I'm successful in doing so, but not before having some 150 dragdrop methods in every single control (a three page pageframe that do quite a bit of stuff in each page) that do the same thing:
LPARAMETERS oSource, nXCoord, nYCoord
thisform.DragDrop(oSource, nXCoord, nYCoord)

Surely there's a way to do it only once or a couple times instead of 150 that I'm not seeing..... isn't there? Thanks.
 
Put the: thisform.DragDrop(oSource, nXCoord, nYCoord)
in the parent class your controls are subclassed from.

You did subclass all the standard VFP controls before using them, didn't you? [wink]

If you care to, you can now create your own control classes, then hack the SCX to redefine all the controls as your own subclass.

Always backup an SCX/SCT or VCX/VCT before hacking!!

If you create your own subclasses of all the controls, ( ) naming them like: myLabel, myTextBox, etc, then do this:
Code:
USE myform.SCX
REPLACE ALL Class WITH 'my'+alltrim(class), ;
            classloc WITH 'myclasses.vcx' ;
  for not inlist(class,'','dataenvironment','form')
USE

this is a utility designed to do the above: faq184-2849
... probably safer than the above hack...
 
Gameboy,

What do you want to happen as the result of the drop? If you want each of the objects to trigger a different action as a result of the drop, you will indeed have to write code in all the dragdrop methods. But I doubt that it is the case. You probably only have one drag target on the form. For the other controls, it is sufficient to change the drag mouse pointer to a "no drop" icon, which you can do with THISFORM.SetAll.

If that doesn't answer your question, perhaps you could supply a little more information about what you are trying to achieve.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top