Is this a bug in BindEvents?
(been away skiing with my family)
A customer reported this as a bug in BindEvent. Run the code below. Try and drag and drop some text from Word or a file from Windows Explorer onto the form. Nothing happens Try without the BindEvent line, and the user code gets executed.
Can anyone explain what is going on here?
PUBLIC ox
ox=CREATEOBJECT("xMyForm")
DEFINE CLASS xMyForm AS Form
OLEDROPMODE = 1
OLEDROPEFFECTS=1
allowoutput=.f.
left=200
PROCEDURE load
this.Show
?BINDEVENT(THIS,"OLEDragOver",THIS,"MyOLEDragOver",1)
PROCEDURE OLEDragOver(oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState)
?PROGRAM()
PROCEDURE MyOLEDragOver(oDataObject, nEffect, nButton, nShift, nXCoord, nYCoord, nState)
?PROGRAM()
ENDDEFINE
Comments
- Anonymous
February 27, 2006
Hi Calvin,
The 5th parameter of the BindEvent() function is set at 1 which according to VFP Help means:
<p>
"Call event code before delegate code"
<p>
I changed the parameter to 0 (default - Call delegate code before event code), but still nothing happens. Setting it to 2 also nothing happens. Setting it to a 3 the event code fires but the delegate code never does. Setting the flag to 4 nothing happens.
Shouldn't both events fire if the flag is at 0 or 1 (0 just means call delegate code first)?
The description in VFP Help for flag values of 2 and 3 is hard to understand. What is meant by "simple method call"?
I vote that this is a bug.
-Ryan - Anonymous
February 28, 2006
>> Can anyone explain what is going on here <<
Hm, if Calvin doesn't know what's going on, who else could be that? - Anonymous
February 28, 2006
This is because the OleDragOver has reference parameters (the oDataObject). This causes trouble.
To solve this, you should call RAISEVENT in the form's OleDragOver Event. - Anonymous
March 03, 2006
In this post: Is this a bug in BindEvents? I asked why drag/drop wasn’t working.
&nbsp;
The code to... - Anonymous
March 08, 2006
A customer had a question and sent some code:
&nbsp;
PUBLIC oHandler
oHandler = NEWOBJECT("StatusBarText")...