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. (note that this problem is only happen in VFP6. i have not tested in VFP7 and VFP8/9 are ok)
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?

