Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
All,
We would like to disable File, New in Creo 5 if the user is connected to PDM and if they are in Offline, then File New is enabled.
Has anyone figured out the code for this?
Input is much appreciated.
This should be possible using a Bracket function.
I haven't tried running it myself yet, but here's some pseudocode for ProToolkit:
/*! @brief An example uiCmdCmdBktFn function to stop the command from running
* @details Use 'ProServerIsOnline' to determine if the server is online
*/
int stop_the_desired_function(uiCmdCmdId command,
uiCmdValue* p_new_value,
int entering_command,
void** pp_bracket_data) {
if (entering_command ==1) {
// Get the current server
wchar_t* server_alias;
ProError err = ProServerActiveGet(&server_alias);
if (err != PRO_TK_NO_ERROR) { return 1; } // if we don't have a server, allow action
// Check if the server is set to "online"
ProBoolean server_is_online = PRO_B_FALSE;
err = ProServerIsOnline(server_alias, &server_is_online);
ProWstringFree(server_alias);
if (server_is_online == PRO_B_TRUE) {
return 0; // stop the command from running
}
}
}
For some more options... check out "Manipulating Existing Commands", which should be in the following file in your Creo install: <creo_install>/protoolkit/protkdoc/manual0/Menus.html#4
Also, as an FYI, this process should look pretty similar in either the C++ OTK, but obviously the code would look a bit different. I haven't checked the docs, but I would assume that the Java OTK should look pretty similar as well.
Hope this helps!
Thanks,
James Sullivan