Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drag Drop _Screen Label Objects
Message
From
29/09/2005 16:02:23
 
 
To
29/09/2005 13:12:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01054569
Message ID:
01054663
Views:
22
>I would like to be able to drag and drop label objects created using a command similar to _SCREEN.ADDOBJECT('FavoritesLabel','Test'). I used the code in the sample DDrop.scx. The problem is the control will drag but when I release the mouse it returns to the original location. What setting am I missing? How can I get the label to move to the dragged position?

Hi Jeff,

Take a look in VFP Solution sample:

"Programming" -> "Fun with OLE drag and drop"


Update:
First, my apology for not reading carefully.

In your case, you have to put the DragDrop method for the _Screen. Create a custom method (i.e: Screen_DragDrop() ), then BindEvent the _Screen.DragDrop to that.

Here is the sample class:
Define class clsText as label
   Caption = "DragDrop Label"
   Height = 17
   Width = 40
   *-- XML Metadata for customizable properties
   _memberdata = ""
   nposx = 0
   nposy = 0
   Name = "clsText"


   Procedure Screen_DragDrop
   LParameters oSource, nXCoord, nYCoord

      oSource.Left = oSource.Left + (nXCoord - .nPosX)
      oSource.Top = oSource.Top + (nYCoord - .nPosY)
   EndProc


   Procedure DragDrop
   LParameters oSource, nXCoord, nYCoord

      This.Parent.DragDrop( oSource, nXCoord, nYCoord )
   EndProc


   Procedure Destroy
      UnBindEvents( _Screen, 'DragDrop', This, 'Screen_DragDrop' )
   EndProc


   Procedure MouseMove
   LParameters nButton, nShift, nXCoord, nYCoord

      If (nButton == 1)
         With This
            .nPosX = nXCoord
            .nPosY = nYCoord
            .Drag
         EndWith
      endif
   ENDPROC


   Procedure Init
      BindEvent( _Screen, 'DragDrop', This, 'Screen_DragDrop' )
   EndProc

EndDefine
HTH
Herman
Previous
Reply
Map
View

Click here to load this message in the networking platform