02-17-2007 07:52 AM
02-19-2007 01:20 PM - edited 02-19-2007 01:20 PM
Message Edited by Patrick P. on 02-19-2007 01:20 PM
02-20-2007 09:02 AM
02-21-2007 11:01 AM - edited 02-21-2007 11:01 AM
Message Edited by Patrick P. on 02-21-2007 11:01 AM
02-22-2007 11:41 AM
Patrick - You the MAN!
This worked perfectly and is exactly what we wanted! There where some small changes that I made to add a seperator and to use a different method to check for sequence files (TS_StepGetIsSequenceCall ()), but your help allowed me to get this running and understanding how it worked in about 15 minutes! I've pasted my version of the BuildSequenceViewContextMenu () call that added a seperator, removed unused variables, and added error check parameters as locals.
static int BuildSequenceViewContextMenu(int menuHandle)
{
ERRORINFO errorInfo = {0, 0, "", "", "", 0, 0};
ErrMsg errMsg = "";
int error = 0;
CAObjHandle cmds = 0;
CAObjHandle viewMgr;
TSUIObj_SelectedSteps SelectedSteps;
TSUISUPPObj_Step SelectedStep;
TSUIObj_Command CustomCommand = 0;
VARIANT userData;
VBOOL sequenceCall = FALSE;
// determine which view manager menu commands apply to
errChk( GetActiveViewManager(&viewMgr));
tsErrChk( TSUI_ApplicationMgrNewCommands(gMainWindow.applicationMgr, &errorInfo, &cmds));
//Check to see if step we are selecting is a SequenceCall
tsErrChk( TSUI_SequenceFileViewMgrGetSelectedSteps (gMainWindow.sequenceFileViewMgr,
&errorInfo, &SelectedSteps));
tsErrChk( TSUISUPP_SelectedStepsGetItem (SelectedSteps, &errorInfo, 0, &SelectedStep));
tsErrChk( TS_StepGetIsSequenceCall (SelectedStep, &errorInfo, &sequenceCall));
//If it is a sequencecall, we insert Open Sequence into the menu
if(sequenceCall)
{
tsErrChk( TSUI_ApplicationMgrGetCommand (gMainWindow.applicationMgr, &errorInfo,
TSUIConst_CommandKind_Custom, 0,
&CustomCommand));
tsErrChk( TSUI_CommandSetEnabled (CustomCommand, &errorInfo, VTRUE));
tsErrChk( TSUI_CommandSetVisible (CustomCommand, &errorInfo, VTRUE));
CA_VariantSetInt (&userData, 61455);
tsErrChk( TSUI_CommandSetUserData (CustomCommand, &errorInfo, userData));
tsErrChk( TSUI_CommandSetDisplayName(CustomCommand, &errorInfo, "Open Sequence..."));
tsErrChk( TSUI_CommandsInsert (cmds, &errorInfo, CustomCommand, 0));
tsErrChk( TSUI_CommandsInsertKind (cmds, &errorInfo, TSUIConst_CommandKind_Separator,
viewMgr, -1, "", "", NULL));
}
// insert items for default sequence view context menu in the context menu
tsErrChk( TSUI_CommandsInsertKind(cmds, &errorInfo, TSUIConst_CommandKind_DefaultSequenceViewContextMenu_Set,
viewMgr, -1, "", "", NULL));
/* we are using the context menu that the SequenceView control provides because it requires
fewer lines of code. We could have built a CVI context menu instead and displayed it with RunPopupMenu().
If you display a CVI context menu, remember to convert the activeX-control-right-mouse click coordinates
from control coordinates to panel coordinates by adding the top and left of the control to the click
position. */
tsErrChk( TSUI_CommandsInsertIntoWin32Menu (cmds, &errorInfo, menuHandle, 0, VTRUE, VTRUE));
Error:
CA_DiscardObjHandle(cmds);
CA_DiscardObjHandle(SelectedSteps);
CA_DiscardObjHandle(SelectedStep);
if(CustomCommand)
{
CA_DiscardObjHandle(CustomCommand);
}
return error;
} // BuildSequenceViewContextMenu
Thanks Pat!
-Jack
02-23-2007 09:36 AM
02-23-2007 09:53 AM
02-23-2007 10:01 AM