MS CE, Update 15, Language: C++
This question concerns using of change tracking functions. Callback function is set as follows:
ChangeTrack::AddChangedFunction (myChangeTrackFunc)
Signature of myChangeTrackFunc is:
myChangeTrackFunc
void ChangeTrackFunc_Changed( MSElementDescrP newDescr, MSElementDescrP oldDescr, DgnPlatform::ChangeTrackInfo *info, bool *cantBeUndoneFlag)
Argument DgnPlatform::ChangeTrackInfo *info is declared as follows (in ITxnManager.h):
Argument DgnPlatform::ChangeTrackInfo *info
struct ChangeTrackInfo { ChangeTrackAction action; //!< type of action Int32 processNumber; //!< process active at time of entry Int16 funcname; //!< Number of RTYPE_CMDNAME resource. Int32 idNumber; //!< id for grouping undos };
My question relates to structure member funcname. It is described as: Number of RTYPE_CMDNAME resource.
funcname
What does that mean ??? Where do I get this requested command number from ???
Background:In my code I'm using several MicroStation commands to modify existing MicroStation elements (like : trim extend, trim tointersection, etc.)Each element modified by one of these MicroStation commands has to be processed by my callback function myChangeTrackFuncdepending on the MicroStation command which has modified the current element.
So my callback function would look as something like this:
void yourChangeTrackFunc (MSElementDescrP newDescr, MSElementDescrP oldDescr, DgnPlatform::ChangeTrackInfo *info, bool *cantBeUndoneFlag) { switch (info->action) { case ChangeTrackAction::Modify: { // Element modified switch info->funcname: { case <Number of RTYPE_CMDNAME resource MS Cmd: Trim Extend>: { ... } break; case <Number of RTYPE_CMDNAME resource MS Cmd: Trim ToIntersection>: { ... } break; ... more MS Commands } } break; } }
Any hints are appreciated. Thanks.
Martin Gitschel
Hi Martin Gitschel,
There are a couple different API areas to review/evaluate to decide what may be best to implement based on your unique needs.
If your application has need to filter/prevent certain command(s), the input queue is best to implement filtering based on knowing: Task Name + CommandId criteria.
If your application has interest in the elements modified by a particular Task + CommandId; change tracking can be utilized. See Code Snippet: C++ ChangeTrackChanged that will help provide those missing details for *many* Command items not listed in: ..\Include\Mstn\cmdlist.r.h.
NOTE: Although there is mention to RTYPE_CMDNAME, it may be best to think of this as a "Tool Name" entry convention and the code snip above provides a shortcut on how to extract the tool name that can become more involved using the RTYPE_CMDNAME ID provided in ChangeTrackChanged event arg.
HTH,Bob
Thanks Robert, for your answer. I think, it willbwe helpful.