Steve-vfp9user
Programmer
In a follow up to a previous question ( I would like to add the working code below to a form so I can add some additional fields from a table to it.
Kindly resolved by Chriss, this is what I have now:
From here I have tried to create a form by:
[ul]
[li]Modify form IMAGES[/li]
[li]Added a table to the dataenvironment[/li]
[li]Added an image control called myImage[/li]
[li]Added the below to the myImage procedure OLEDragOver[/li]
[/ul]
Adding the below to the myImage procedure OLEDragDrop
I have also changed the image control to OLEDropMode=1 and Stretch=1 (for isometric).
When I run the form and try to drag over and image and drop it from a windows folder, it works with the original code but doesn't allow me on the form I'm trying to create.
What am I missing please?
Thank you
Steve Williams
VFP9, SP2, Windows 10
Kindly resolved by Chriss, this is what I have now:
Code:
Public oForm
oForm = Createobject("Images")
oForm.Show()
Define Class images As Form
Height=450
Width=450
AutoCenter = .T.
BorderStyle = 2
Add Object myImage As Image With ;
Left = 10,Top=10,Height=430,Width=430,OLEDropMode=1,Stretch=1
Procedure myImage.OLEDragOver
Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
If m.nState = 0 And oDataObject.GetFormat( 15 )
This.OLEDropEffects = 5
This.OLEDropHasData = 1
Else
This.OLEDropEffects = 0
This.OLEDropHasData = 0
Endif
Endproc
Procedure myImage.OLEDragDrop
Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
If oDataObject.GetFormat( 15 )
Local Array laData[1]
oDataObject.GetData(15,@laData)
[b]APPEND MEMO PHOTO FROM laData[1][/b]
This.PictureVal = Photo
ENDIF
Endproc
Enddefine
From here I have tried to create a form by:
[ul]
[li]Modify form IMAGES[/li]
[li]Added a table to the dataenvironment[/li]
[li]Added an image control called myImage[/li]
[li]Added the below to the myImage procedure OLEDragOver[/li]
[/ul]
Code:
Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState
If m.nState = 0 And oDataObject.GetFormat( 15 )
This.OLEDropEffects = 5
This.OLEDropHasData = 1
Else
This.OLEDropEffects = 0
This.OLEDropHasData = 0
Endif
Adding the below to the myImage procedure OLEDragDrop
Code:
Lparameters oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord
If oDataObject.GetFormat( 15 )
Local Array laData[1]
oDataObject.GetData(15,@laData)
APPEND MEMO PHOTO FROM laData[1]
This.PictureVal = Photo
Endif
I have also changed the image control to OLEDropMode=1 and Stretch=1 (for isometric).
When I run the form and try to drag over and image and drop it from a windows folder, it works with the original code but doesn't allow me on the form I'm trying to create.
What am I missing please?
Thank you
Steve Williams
VFP9, SP2, Windows 10