cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

RE: RE: Notification for [File->Close Window] action

vinaym
1-Newbie

RE: RE: Notification for [File->Close Window] action

Finally found the solution for this.



Limitations of other solutions:

ProMenubuttonPreactionSet() and ProMenubuttonPostactionSet() work for
Menu-Manager (mode-specific) menus only.

PRO_WINDOW_CHANGE_POST will be useful if there are multiple windows and
one of them is closed.



Correct Solution:

I am using ProCmdBracketFuncAdd to catch the command.

For this, we must know the command name which we can obtain from Trail
file.

For "File->Close Window" the command name is "ProCmdWinClose".



/*--------------------------------------------------------------------*/



/* Find uiCmdCmdId of the command to be handled */

uiCmdCmdId close_window_cmd_id;

status = ProCmdCmdIdFind("ProCmdWinClose", &close_window_cmd_id);



/* Catch the command */

if (status == PRO_TK_NO_ERROR)

{

ProCmdBracketFuncAdd(close_window_cmd_id,

(uiCmdCmdBktFn) FileCLoseAction,

"FileCLoseAction",

(void**)NULL);

}



ProError FileCLoseAction(uiCmdCmdId command, uiCmdValue *p_new_value,

int entering_command, void **data)

{

/* entering_command = 1, before executing the command

entering_command = 0, after executing the command



return PRO_TK_NO_ERROR if you don't want the command to be
executed.

In this case Model will not be closed, if you return
PRO_TK_NO_ERROR.

*/



return PRO_TK_CONTINUE;

}



//--------------------------------------------------------------------



Please let me know if this solution doesn't work for any of you.

I would like to deal with the scenario in which this solution fails.



Regards,



Vinay


0 REPLIES 0
Announcements
Business Continuity with Creo: Learn more about it here.

Top Tags