I’m having problems with dragitems. Assigning a picture to the dragitem (either thru the constructor or setting DragPicture seperately) does not display the picture. If I don’t bother setting the DragPicture I don’t get the rectangle either. All I see in either case is the cursor being a circle with a line thru it until I get to a legal drop location. Is there some trick to making DragPicture work, or will I have to drag around a Imagewell to acomplish what I want?
Try with the folderitem and see what happens.
What platform are you on?
I’m on Windows 7.
Just to be sure…
DragPicture is to drag an image say from a Webpage or email
DragFolder is to drag a file (which may be a JPG, PNG etc)… you’d get just the filename and have to open it as a picture.
you are using the right Drag type for the data involved…?
There is no data involved Dave. The DragPicture property is supposed to put an image underneath the cursor instead of a rectangle. And I can’t even get the rectangle either.
I use this all the time (under OSX) and it works fine…
Please post a snippet of code show how you are implementing this
Okay, here is the code is in its entirety in the MouseDown event of a Canvas:
[code] dim a,b as integer
dim dr as DragItem
a=Floor(X/50) b=Floor(Y/50) if Grid(a,b)=0 then return false dr=new DragItem(me,X,Y,50,50) dr.DragPicture=DieInfo(Grid(a,b)).SidePic(0) dr.Text=Str(Grid(a,b)) dr.Drag return true[/code]
well I just opened a new project (OSX)
in the MOUSEDOWN event of the window I put
dim dr as DragItem dim p as picture p=new picture(40,50,32) p.Graphics.ForeColor=&cff0000 p.Graphics.FillRect 0,0,40,50 dr=new DragItem(me,x,y,50,50) dr.DragPicture=p //dr.Text="text" dr.Drag return true
a modified version of what you had (since I didn’t have all your support stuff)
I press the mouse and a red box follows me around… just like it should
dr.text is ignored
so I submit that perhaps SIDEPIC is nil?
Verified thru the debugger that SidePic does have a picture in it (plus I can see it on the canvas).
Also verfied thru the debugger that the DragPicture property does have the correct picture in it. So for some reason it is not displaying it. Does DragPicture simply not work on Windows? The docs do not give any indication that this property is platform specific.
Well I just ran the code I posted above (copy/paste) under XOJO and WIN7 and it worked there as well
Hmm, I just tried your code in a new project and I got nothing - no red rectangle, no default drag rectangle, just the cursor.
Some code in RB2010r2 (without the dragpicture of course) gives me the drag rectangle at least.
then something else in your project is killing it.
Note : the code I posted is ALL I used … there was no ACCEPTxxx commands etc… (as I didn’t implement a DropObject)
Try my code all by itself in a new projec and see what happens
That is exactly what I did and I’m not getting anything.
Thanks for trying to help.
in a NEW project? where that was the ONLY code?
There’s 2 properties
One is the data being dragged (picture) one is the image to show for the drag being done (drag picture)