Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EventHandler(OLEcontrol.ListImages, oEventHandler) fails

Status
Not open for further replies.

foxincloud

Vendor
Jan 24, 2011
43
FR
Hi,

Using an OLEcontrol with .OLEclass = 'MSComctlLib.ImageListCtrl.2', I try to bind events of the 'ListImages' collection to a VFP handler object (see test code below)

EventHandler() always return .F.

Any idea why?

Thanks
Code:
local oForm, ListImages_Handler

activate screen
clear

oForm = CreateObject('form')
? Datetime(), 'awOLEiml6', Iif(oForm.AddObject('awOLEiml6', 'awOLEiml6'), 'OK', 'KO :(') && aw.vcx!awOLEiml6 is an OLEcontrol with .OLEclass = 'MSComctlLib.ImageListCtrl.2'
&& ftp://foxincloud.com/ab/aw.vcx
&& ftp://foxincloud.com/ab/aw.vct

ListImages_Handler = CreateObject("ListImages_Handler") && see below
? Datetime(), 'ListImages_Handler', Iif(Vartype(m.ListImages_Handler) == 'O', 'OK', 'KO :(')

*suspend

? Datetime(), 'EventHandler()', iif(EventHandler(m.oForm.awOLEiml6.ListImages, m.ListImages_Handler), 'OK', 'KO :(')

? Datetime(), 'ListImages.add()', Iif(Vartype(m.oForm.awOLEiml6.ListImages.add(, Home(1) + 'Graphics\Bitmaps\Gauge\dome.bmp', LoadPicture(Home(1) + 'Graphics\Bitmaps\Gauge\dome.bmp'))) == 'O', 'OK', 'KO :(')


DEFINE CLASS ListImages_Handler AS session && OLEpublic

	IMPLEMENTS IImages IN "MSComctlLib.ImageListCtrl.2"

	PROCEDURE IImages_get_ControlDefault(Index AS VARIANT) AS VARIANT
	* add user code here
	ENDPROC

	PROCEDURE IImages_put_ControlDefault(Index AS VARIANT) AS VARIANT
	* add user code here
	ENDPROC

	PROCEDURE IImages_get_Count() AS INTEGER;
 				HELPSTRING "Returns the number of objects in a collection."
	* add user code here
	ENDPROC

	PROCEDURE IImages_put_Count(eValue AS INTEGER @);
 				HELPSTRING "Returns the number of objects in a collection."
	* add user code here
	ENDPROC

	PROCEDURE IImages_get_Item(Index AS VARIANT) AS VARIANT;
 				HELPSTRING "Returns a specific member of a Collection object either by position or by key."
	* add user code here
	ENDPROC

	PROCEDURE IImages_put_Item(Index AS VARIANT, Key AS VARIANT, Picture AS VARIANT) AS VARIANT
	&& 2017-09-19 thn -- {en} added for instantiation to succeed
	ENDPROC

	PROCEDURE IImages_Add(Index AS VARIANT, Key AS VARIANT, Picture AS VARIANT) AS VARIANT;
 				HELPSTRING "Adds a ListImage object to a ListImages collection and returns a reference to the created object."
	* add user code here
? 'IImages_Add()', m.key
	ENDPROC

	PROCEDURE IImages_Clear() AS VOID;
 				HELPSTRING "Removes all objects in a collection."
	* add user code here
	ENDPROC

	PROCEDURE IImages_Item(Index AS VARIANT) AS VARIANT;
 				HELPSTRING "Returns a specific member of a Collection object either by position or by key."
	* add user code here
	ENDPROC

	PROCEDURE IImages_Remove(Index AS VARIANT) AS VOID;
 				HELPSTRING "Removes a specific member from a collection."
	* add user code here
	ENDPROC

	PROCEDURE IImages__NewEnum() AS VARIANT
	* add user code here
	ENDPROC

enddefine



Thierry Nivelet (French native speaker)
FoxInCloud, ZenBuyer, IntuiCat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top