Welcome to MSDN Blogs Sign in | Join | Help

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

 

Published Monday, February 27, 2006 3:45 PM by Calvin_Hsia

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# re: Is this a bug in BindEvents?

Monday, February 27, 2006 7:20 PM by RyanNerd
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

# re: Is this a bug in BindEvents?

Tuesday, February 28, 2006 8:50 AM by wOOdy
>> Can anyone explain what is going on here <<

Hm, if Calvin doesn't know what's going on, who else could be that?

# re: Is this a bug in BindEvents?

Tuesday, February 28, 2006 12:03 PM by SDavila
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.

# Why doesn't drag/drop work with BindEvents?

Friday, March 03, 2006 1:53 PM by Calvin Hsia's WebLog
In this post: Is this a bug in BindEvents? I asked why drag/drop wasn’t working.
&amp;nbsp;
The code to...

# Why does BINDEVENT not work with StatusBar_Change?

Wednesday, March 08, 2006 8:30 PM by Calvin Hsia's WebLog
A customer had a question and sent some code:
&amp;nbsp;
PUBLIC oHandler
oHandler = NEWOBJECT(&quot;StatusBarText&quot;)...

Leave a Comment

(required) 
required 
(required) 

  
Enter Code Here: Required
 
Page view tracker