I have created a COM Add-in for Outlook using VFP 8. I create a toolbar and stick the buttons on the toolbar into an array. I then use the eventhandler function for each button in array. There are three buttons on the toolbar. Now for the confusing part, it works perfectly fine on another developers Win2K machine. But on both my Win2K and Win98 machines it causes my the click event for a button to fire 3 times. Here is a sample of my code.
** start of example
l_oCommandBar = l_oCommandBars.ADD(c_cToolBarName,;
c_nBarTop, .F., .F.)
l_oControls = l_oCommandBar.CONTROLS
g_aExpButtons(1) = l_oControls.ADD(c_nControlButton)
WITH g_aExpButtons(1)
.CAPTION = c_cSaveEmail
.STYLE = c_nButtonIconAndCaption
.FaceId = c_nSaveEmail
.VISIBLE = .T.
.TAG = "0"
ENDWITH
g_aExpButtons(2) = l_oControls.ADD(c_nControlButton)
WITH g_aExpButtons(2)
.CAPTION = c_cRetrieveEmail
.STYLE = c_nButtonIconAndCaption
.FaceId = c_nRetrieveEmail
.VISIBLE = .T.
.TAG = "0"
ENDWITH
g_aExpButtons(3) = l_oControls.ADD(c_nControlButton)
WITH g_aExpButtons(3)
.CAPTION = c_cFindEmail
.STYLE = c_nButtonIconAndCaption
.FaceId = c_nFindEmail
.VISIBLE = .T.
.TAG = "0"
ENDWITH
EVENTHANDLER(g_aExpButtons(1), .r_oExpButtonEvents, .F.)
EVENTHANDLER(g_aExpButtons(2), .r_oExpButtonEvents, .F.)
EVENTHANDLER(g_aExpButtons(3), .r_oExpButtonEvents, .F.)
** end of example
When I comment out the the 2nd and 3rd eventhandler line everything works fine on both my machines for all 3 buttons on my toolbar, but the other developers 2nd and 3rd buttons won't do anything.
Am I missing a SET command or a SYS function that could take care of this? Does anyone have any experience with the eventhandler? This is out first project using VFP 8 (previously using VFP 6) so my experience with these new features is limited.
I am pulling my hair out. Please someone help.
Thanks
Dave
** start of example
l_oCommandBar = l_oCommandBars.ADD(c_cToolBarName,;
c_nBarTop, .F., .F.)
l_oControls = l_oCommandBar.CONTROLS
g_aExpButtons(1) = l_oControls.ADD(c_nControlButton)
WITH g_aExpButtons(1)
.CAPTION = c_cSaveEmail
.STYLE = c_nButtonIconAndCaption
.FaceId = c_nSaveEmail
.VISIBLE = .T.
.TAG = "0"
ENDWITH
g_aExpButtons(2) = l_oControls.ADD(c_nControlButton)
WITH g_aExpButtons(2)
.CAPTION = c_cRetrieveEmail
.STYLE = c_nButtonIconAndCaption
.FaceId = c_nRetrieveEmail
.VISIBLE = .T.
.TAG = "0"
ENDWITH
g_aExpButtons(3) = l_oControls.ADD(c_nControlButton)
WITH g_aExpButtons(3)
.CAPTION = c_cFindEmail
.STYLE = c_nButtonIconAndCaption
.FaceId = c_nFindEmail
.VISIBLE = .T.
.TAG = "0"
ENDWITH
EVENTHANDLER(g_aExpButtons(1), .r_oExpButtonEvents, .F.)
EVENTHANDLER(g_aExpButtons(2), .r_oExpButtonEvents, .F.)
EVENTHANDLER(g_aExpButtons(3), .r_oExpButtonEvents, .F.)
** end of example
When I comment out the the 2nd and 3rd eventhandler line everything works fine on both my machines for all 3 buttons on my toolbar, but the other developers 2nd and 3rd buttons won't do anything.
Am I missing a SET command or a SYS function that could take care of this? Does anyone have any experience with the eventhandler? This is out first project using VFP 8 (previously using VFP 6) so my experience with these new features is limited.
I am pulling my hair out. Please someone help.
Thanks
Dave