VFP6-Did anyone experience this problem (with ActiveX Ctrl)?

hello guys,

I post here my problem and hope that there will be certain VFP expert to help. The problem was that when i call the MouseDown event from an OleListView control (this ole is inserted in FORM1). This MouseDown event will show a shortcut menu (1st shortcut). A Command in the 1st shortcut will open a modal form named FORM2 and on form2 is also placed another activeX listview control.
The MouseDown event of this olelistview will show another shortcut menu (2nd shortcut). The problem was that if form2 is a modal form then all events on its activeX will not execute. These problem seems to be fixed in VFP8/9 but i still want to know how to get rid of this problem in VFP6

To illustrate this problem specifically, pls try create a form and insert an OleListView control to that form.
In the ole MouseDown event, add this code
*//-
*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y
LOCAL m.nIdx, i
IF button=2
m.nIdx=0
DEFINE popup _1stMenu shortcut from mrow(),mcol() font 'tahoma', 8 margin relative
FOR i=1 to 5
DEFINE bar i of _1stMenu prompt "Command N#"+alltrim(str(i )) ;
font 'tahoma',8 style 'N' message 'Test command '+alltrim(str(i ))
ON selection bar (i) of _1stMenu m.nIdx=bar()
NEXT i
Activate popup _1stMenu
Deactivate popup _1stMenu
Rele popup _1stMenu
IF m.nIdx=0
RETURN
ELSE
DO form Form2.scx
ENDIF
ENDIF
*//-
then, save the form above with the name form1 and again save as another form name Form2,
set WindowType property of Form2 to 1 (modal) and modify its MouseDown event as the code
below:
*//-
*** ActiveX Control Event ***
LPARAMETERS button, shift, x, y
LOCAL m.nIdx, i
IF button=2
m.nIdx=0
DEFINE popup _2ndMenu shortcut from mrow(),mcol() ;
font 'tahoma', 8 margin relative
FOR i=1 to 5
DEFINE bar i of _2ndMenu prompt "Command N#"+alltrim(str(i )) ;
font 'tahoma',8 style 'N' message 'Test command '+alltrim(str(i ))
ON selection bar (i) of _2ndMenu m.nIdx=bar()
NEXT i
Activate popup _2ndMenu
Deactivate popup _2ndMenu
Rele popup _2ndMenu
IF m.nIdx=0
RETURN
ELSE
IF messagebox("Add an items to list?",4+32,"test")=6
this.ListItems.add ;
(this.ListItems.count+1,alltrim(str(this.ListItems.count))+"_","Item n#"+alltrim(str(this.ListItems.count)))
ENDIF
ENDIF
ENDIF
*//
do form1.scx then RightClick on the listview and select an item on shortcut menu will open form2.scx but if you rightclick on the listView on Form2 then you can see nothing.What was wrong? How to get rid of this problem?

(note that this problem is only happen in VFP6. i have not tested in VFP7 and VFP8/9 are ok)

[2894 byte] By [kanguru] at [2008-2-27]
# 1
Do you have code in the MouseUp event?
That was something that worked in other environments.
AndrewMacNeill at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 2
In VFP 6 you have to use a timer to avoid problems with ActiveX event handling. In the MouseDown event instead of displaying the form, just start a timer with an interval of 10 ms. In the timer event first of all disable the timer, then execute the code you had previously in the MouseDown event.

Is there any particular reason, you don't want to use VFP 9?

ChristofWollenhaupt at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 3
No, there is no code MouseUp event. Anyway, this error will occur with any ActiveX event in form1 call to open form2.
kanguru at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 4
Thanks ChristofWollenhaupt

Using a timer. Very nice trick, the code in form 2 excecute indeed! Of course, now i'm using VFP9 because it's the greatest of all version of VFP. I want to use VFP6 to compile some of my programs running on old PC with windows98

kanguru at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 5
While it's not officially supported, for the most parts VFP 9 should work on Windows 98 machines if you install IE 6.0 and gdiplus.dll. It doesn't work on Windows NT and Windows 95, though. If you haven't tested your application on Windows 98 with VFP 9, it might be worth a try.
ChristofWollenhaupt at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...
# 6
Dear Christof Wollenhaupt

Thankyou for your informations. Frankly, I've intended to compile my application in VFP9 and test it on Win98 machine. But not now, I'm struggling with another new project. Anyway, I will try when i have extra time

kanguru at 2007-9-8 > top of Msdn Tech,Visual FoxPro,Visual FoxPro General...