S
Scott Metzger
Hi,
Ok, what I want to do is have my 'mapped' event only fire when a
specific User Defined cell is changed in a Shape object. When I use the
following filter my function is still called for every Cell change.
void CVisioReadDlg::OnBnClickedCommandbar()
{// create an event map when the User.Listen cell changes
IUnknown FAR* pSink = NULL;
CVisioEventList vsoEList;
CVisioEvent vsoEvent;
if ( SUCCEEDED(vsoApp.EventList(vsoEList)) )
{
if (SUCCEEDED(CoCreateAddonSink(UserCellChanged, &pSink)) )
{
if ( SUCCEEDED(vsoEList.AddAdvise( (short)(visEvtShape |
visEvtCell | visEvtMod),VVariant(pSink),
VBstr(_T("")), VBstr(_T("")),
vsoEvent)))
{
vsoEvent.ID(&stclUserCellEventID);
VSafeArray filter(VT_I2, (ULONG)7, (LONG)0);
long index[7];
filter.PutElement(index, (void*)visSectionUser);
filter.PutElement(index, (void*)visRowUser);
filter.PutElement(index, (void*)visUserValue);
filter.PutElement(index, (void*)visSectionUser);
filter.PutElement(index, (void*)visRowUser);
filter.PutElement(index, (void*)visUserValue);
filter.PutElement(index, (void*)1);
vsoEvent.SetFilterSRC(filter);
}
} // end if created sink event
} // end if got list of events
}
I am unsure about a few things:
1) I am using the VSafeArray class because I couldn't figure out how to
use a SAFEARRAY, but am I using the VSafeArray class correctly? or
could someone post an example of setting up a SAFEARRAY filter?
2) Are my From Row and Cell and To Row and Cell constants correct? I
just want to 'trigger' off the 1st Value cell in a User-Defined section.
3) When I set the filter to True (1), that should indicate that I only
want to 'trigger' when this one specific condition occurs. Is that correct?
Thanks,
Scott Metzger
Ok, what I want to do is have my 'mapped' event only fire when a
specific User Defined cell is changed in a Shape object. When I use the
following filter my function is still called for every Cell change.
void CVisioReadDlg::OnBnClickedCommandbar()
{// create an event map when the User.Listen cell changes
IUnknown FAR* pSink = NULL;
CVisioEventList vsoEList;
CVisioEvent vsoEvent;
if ( SUCCEEDED(vsoApp.EventList(vsoEList)) )
{
if (SUCCEEDED(CoCreateAddonSink(UserCellChanged, &pSink)) )
{
if ( SUCCEEDED(vsoEList.AddAdvise( (short)(visEvtShape |
visEvtCell | visEvtMod),VVariant(pSink),
VBstr(_T("")), VBstr(_T("")),
vsoEvent)))
{
vsoEvent.ID(&stclUserCellEventID);
VSafeArray filter(VT_I2, (ULONG)7, (LONG)0);
long index[7];
filter.PutElement(index, (void*)visSectionUser);
filter.PutElement(index, (void*)visRowUser);
filter.PutElement(index, (void*)visUserValue);
filter.PutElement(index, (void*)visSectionUser);
filter.PutElement(index, (void*)visRowUser);
filter.PutElement(index, (void*)visUserValue);
filter.PutElement(index, (void*)1);
vsoEvent.SetFilterSRC(filter);
}
} // end if created sink event
} // end if got list of events
}
I am unsure about a few things:
1) I am using the VSafeArray class because I couldn't figure out how to
use a SAFEARRAY, but am I using the VSafeArray class correctly? or
could someone post an example of setting up a SAFEARRAY filter?
2) Are my From Row and Cell and To Row and Cell constants correct? I
just want to 'trigger' off the 1st Value cell in a User-Defined section.
3) When I set the filter to True (1), that should indicate that I only
want to 'trigger' when this one specific condition occurs. Is that correct?
Thanks,
Scott Metzger