Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Yousfi Benameur
  Where is Yousfi Benameur?
 El Bayadh
 Algeria
 Yousfi Benameur
 To: Bernard Bout
  Where is Bernard Bout?
 Brisbane
 Australia
 Bernard Bout
 Tags
Subject: RE: drop any image on form & listbox
Thread ID: 232560 Message ID: 233144 # Views: 25 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Active X Controls & OLE Automation
Date: Tuesday, June 30, 2009 10:37:14 AM         
   


> >
> >
> > you want to drag & drop a bomb into my listbox.its normal it is "anti bomb" :-U
> > I tried to use a textbox but unsuccessfully. If you have a solution...thanks in advance.
> >
> > Dont rate please.its only for the pleasure to help.Give me only a feed back.
> > Yousfi Benameur
>
> To fix this error,just add this code to your Form::OleDragDrop event:
>
>
oDataObject.GetData(15, @aValues )
> If EMPTY(aValues) &&<------------------------this is new
> 	Return
> Endif             &&<-------------------- End of new code
> For i = 1 To Alen(aValues)
> 

>
> and make the list look like a proper listbox.
>
> Resize it, and AutoHideScrollbar = 0
>
> Now that was much easier to do with a .scx than a prg.
>
> Bernard
>
> ** If you see someone without a smile, give em one of yours :) **
> My Blog

for replacing the listbox by a textbox its done with :
text1.init
this.oledragMode=1   &&automatic
this.oleDropEffects=3
this.OleDropMode=1    && actived  mandatory


text1.dragDrop
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
LOCAL aValues, i, cText, nOperation

Thisform.LockScreen = .T.

	DIMENSION aValues[1]
	oDataObject.GetData(15, @aValues )

	*-- Add picture as a new item in the textbox
	FOR i = 1 to alen(aValues)
if inlist(lower(justext(aValues[m.i])),"jpg","bmp","gif","png")
xval=(aValues[m.i] )
		This.value=xval
	thisform.label1.caption=xval	
		thisform.ypict=xval
		thisform.image1.picture=xval
		thisform.image1.visible=.t.
wait window (xval)	 timeout 0.5		
	
else
thisform.ypict=""
thisform.image1.visible=.f.
thisform.label1.caption=""
endi		
NEXT

Thisform.LockScreen = .F.

*-- Set the nEffect parameter for communication back to the source object
nEffect = nOperation

and text1.oleDragover
LPARAMETERS oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState


DO CASE
CASE nState == 0		&&DRAG_ENTER
	DO CASE
	CASE oDataObject.GetFormat("OLE Variant Array")	&& Array
		This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
		This.OLEDropEffects = 1+2	&&DROPEFFECT_COPY + DROPEFFECT_MOVE
		
	CASE oDataObject.GetFormat(1)				&& Text
		This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
		This.OLEDropEffects = 1+2	&&DROPEFFECT_COPY + DROPEFFECT_MOVE
		
	CASE oDataObject.GetFormat(15)				&& Files CF_HDROP
		This.OLEDropHasData = 1		&&DROPHASDATA_USEFUL
		This.OLEDropEffects = 4		&&DROPEFFECT_LINK
	OTHERWISE
		This.OLEDropHasData = 0		&&DROPHASDATA_NOTUSEFUL
	ENDCASE

CASE nState == 1	&& Drag Leave
CASE nState == 2	&& Drag Over
ENDCASE

tested and works.I add the new zip at the thread end.

Dont rate please.its only for the pleasure to help.Give me only a feed back.
Yousfi Benameur



COMPLETE THREAD
drop any image on form & listbox Posted by Yousfi Benameur @ 6/24/2009 1:08:44 PM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/25/2009 1:54:50 AM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/25/2009 2:36:18 AM
RE: drop any image on form & listbox Posted by Cesar @ 6/25/2009 3:22:04 AM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/25/2009 11:17:22 AM
RE: drop any image on form & listbox Posted by Cesar @ 6/25/2009 3:12:09 PM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/29/2009 5:49:47 PM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/29/2009 7:17:56 PM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/30/2009 2:25:34 AM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/30/2009 10:02:36 AM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/30/2009 2:04:41 PM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/30/2009 10:37:14 AM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/29/2009 5:40:21 PM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/29/2009 5:37:03 PM
RE: drop any image on form & listbox Posted by Glen Villar @ 6/25/2009 1:59:12 AM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/30/2009 10:51:52 AM
RE: drop any image on form & listbox Posted by Bernard Bout @ 6/30/2009 2:10:01 PM
RE: drop any image on form & listbox Posted by Yousfi Benameur @ 6/30/2009 10:24:53 PM