Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Help with drag and drop
Message
From
26/05/2001 06:54:13
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
26/05/2001 03:11:35
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00511772
Message ID:
00511779
Views:
17
This message has been marked as the solution to the initial question of the thread.
>Hi All,
>
>This is my first attempt at trying to incorporate drag and drop in a form.
>
>It is my understanding that in the MouseDown event of an object I can have This.Drag(1) and in the MouseUp event I can have This.Drag(2) and that would do it.
>
>However, when I put This.Drag(0) in the MouseUp event, which to my understanding should cancel the action, VFP still drops the object I'm dragging just as if I had This.Drag(2) in the MouseUp event.
>
>I tried adding a Suspend in the MouseUp event and the suspend doesn't execute. I tried adding a Wait Window "Test" in the MouseUp event and that doesn't execute either. I'm wondering if the MouseUp event is firing at all.
>
>Can anybody offer me some insight. BTW, I'm using VFP 6 from Visual Studio 6.
>
>Thanks in advance for your any assistance.
>
>Aloha,
>
>James

James,
MouseUp is too late and even won't execute.
However another object's (or the one started drag) dragover could end or cancel drag. Otherwise when mouse released dragdrop event of object under mouse occurs if any.
* Mousedown of drag starting object
if nButton = 2
 this.Drag() && or this.Drag(1) -following code doesn't execute till drag ends  
 oTarget = sys(1270) && Obj dropped on
 this.Value = sys(1272, oTarget) 
 with oTarget && Move the receiver - with wait windows we have chance to miss
   .Left = .Left + 10
   .Top = .Top + 10
 endwith
 wait window timeout 2 ;
 "Code after this.drag won't execute till drag ends in any way"
endif

*Another object - dragover
oSource.Drag(0) && Cancel the drag

*Same object's - drapdrop
this.value = oSource.Value
wait window timeout 2 'No chance for me to execute :('

*Another object - dragover
oSource.Drag(2) && End the drag

*Same object's - drapdrop
this.value = oSource.Value
wait window timeout 2 "Haha I'm the ghostbuster :)"

*Another object - dragdrop
this.value = oSource.Value
wait window timeout 2 "I got the value"
BTW if you'd use ActiveX controls then above doesn't work - use OLEDrag* instead available in VFP6 and up.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform