Jump to content
Software FX Community

Question about ChangedByUser Event


wmdyer

Recommended Posts

Just curious if this is how it is supposed to behave, but from what I am seeing this is kind of a pre notification event as in it is letting you know that something WILL be changed as opposed to  the fact that something HAS changed.  Is this how it is supposed to be?

 For example I added this event to the CStaticDialog  class in the CfxCS62TestMfc project that I have as a sample as follows

By the way am I using the appropriate DISPID for ChangedByUser?

//declare event

ON_EVENT( CStaticDialog, IDC_CHART1, 16, OnChangedByUser, VTS_DISPATCH, VTS_DISPATCH )

void CStaticDialog::OnChangedByUser( LPDISPATCH sender, LPDISPATCH args )

{

if( m_chartPtr->Dirty){

VARIANT_BOOL test = m_chartPtr->Chart3D;

m_chartPtr->Dirty = VARIANT_FALSE;

}

}

When I click on the 3D/2D button in the toolbar I get into this function, but for instance if the Chart started out as 3D when I get into this method test evaluates to VARIANT_TRUE.  The next time I click this button in the control which should change it back from 2D to 3D test evaluated to VARIANT_FALSE.  This tells me that this is not really fired when something HAS changed, but rather that something will change.  Is there a notification to know when something CHANGED.  I have other dialogs with additional information that I would like to update when something has changed in the chartfx window and would rather not have to poll this object constantly to do it.

How do I know which DISPID to use for which event?  It was not 100% clear from the samples I got from:

http://support.softwarefx.com/ShowArticle.aspx?Type=KB&Product=CfxCS62&Source=http://support.softwarefx.com/kb/190/1/011.htm

 

Thanks

-Mac

Link to comment
Share on other sites

  • 2 weeks later...

The ChangedByUser event is fired before a change is performed on the chart; however, we only fire this event once since any subsequent changes are considered a waste as the chart is already dirty.

Furthermore, you can implement the InternalCommand event which fires every time a chart command is processed; wether is from the MenuBar, ToolBar, or ContextMenu, this event is always fired. Unfortunately, you cannot tell exactly what change was actually done but you could let the user know that a change was made on the chart.

In regards to the DISPID of the events, a list was not provided in that article since when you right click on the chart, select Events, and add the desired event, this information is automatically provided in the code within the EVENTSINK_MAP portion; however, for your convenience, I am putting here a list of the most commonly used events with their respective DISPIDs:

Event DISPID

AttributesChanged  21

ChangedByUser 16

DataChangedByUser  18

Highlighted   20

InternalCommand 14

MouseDown   10

MouseMove 12

MouseUp   11

UserCommand 15

PostPaint   3

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...