>>I'd like to add a double click event to my image control. This control has been created using the thisform.addobject.
>>
>>How can I do this?
>
>You could create your own class based on Image and add all functionality you want there. Then just use it. Nut I agree with Tore, time for upgrade :-)
You can use the Borislav solution with a small trick.
In the DblClick event of your own class of the VFP Image base class
add the only line of code:
thisform.udf_ImageDblClickHandler(this.name)
or
thisform.some_handler.udf_ImageDblClickHandler(this.name)
In this case You will have an universal handler that
do some work depending of name of the Image:
For example, You add new Image object based on your class into your form
with the name img_Save, then You add the new similar object with the name
img_PrintReport and so on.
In your form You can add custom method, for example, udf_ImageDblClickHandler
or create the class of the handlers based on the Custom class where you can place code all your handlers code and add it to form
This method - udf_ImageDblClickHandler - may include, for example, the following lines of code
LPARAMETERS lpObjectName
Do case
case "save" $ lower(lpObjectName)
do something
return
case "printreport" $ lower(lpObjectName)
do something
return
otherwise
do some generic procedure or command
endcase
Of course, this is a very primitive example, but I had used
it in the time of the VFP6 not only for Image. :-)
And I agree with Borislav and Tore - time to upgrade.