NX Open Programmer's Guide > Execution Methods > Programs, Journals, or Callbacks from Existing Menu Items > Executing Callbacks (Menu Event Handlers)
Executing Callbacks (Menu Event Handlers)
Callbacks tie into menu buttons via the same ACTIONS command used for journals and programs, but differ in two key ways:
- The menu file does not reference the callback name directly — it references a string that must be registered to the callback via
AddMenuAction(C++, VB, C#),addMenuAction(Java), orUF_MB_add_actions(Open C). - Callbacks return a value that can terminate the remaining action list for that button.
Callback Return Values
| Return Value | Meaning |
|---|---|
| Continue | Continue performing the menu item's remaining actions |
| Cancel | User interaction requested inhibiting the menu item's actions |
| Override Standard | Inhibit further actions because a pre-action replaced the standard action for a standard NX menu item |
| Warning | Inhibit further actions due to a warning condition |
| Error | Inhibit further actions due to an error condition |
Programmatically, Cancel, Override Standard, Warning, and Error all behave identically — any value other than Continue stops the rest of the action list from executing. The only practical difference is which value gets logged in the syslog.
Example
A sample registers multiple callbacks on a single menu button, where the first callback's returned status controls whether subsequent actions execute. To test: compile the supplied cb_status_test program, place its library in the startup folder with the sample menu file, launch NX, and go to File tab → Open. A dialog prompts "Select a return status" — choosing values other than Continue prevents the STANDARD Open dialog (and any later actions) from running.
Further language-specific implementation details are in the Open C Reference Guide's relevant chapter.
Related Topics
- Programs, Journals, or Callbacks from Existing Menu Items
- Example Menu File with Actions
- Executing Programs
- Executing Journals
Source: https://docs.sw.siemens.com/en-US/doc/209349590/PL20220512394070742.nxopen_prog_guide/existing_menu_executing_callbacks · retrieved Tue Jul 07 2026 00:00:00 GMT+0000 (Coordinated Universal Time)