NX Open Programmer's Guide > Block Styler Automation > Block Styler Memory and Callbacks > Callbacks
Callbacks
This page defines the complete set of available Block Styler callback methods and the events that invoke each one. All dialogs must provide an Apply and an Initialize method — every other callback method is optional.
Filter
Called whenever the user is selecting NX objects. It is used to let you filter out objects that you do not want to pre-select. See Block Styler Selection Blocks for an example of using the Filter callback.
Update
Called to respond to most events from every block. For instance, if the user enters a text string into a String block and hits the Enter key, the Update method will be called. The code in this method can then determine which block generated the event and can react to the event — for instance, in the String example, the value of the string could be examined for proper format. For a complete description of the Update method and examples of typical usage see Block Styler Update Callback.
Ok
Called to respond to the user hitting the standard Ok navigator button. The standard behavior is for your application to execute an Apply using the current dialog values and then to exit the dialog. The template code will already contain a call to the Apply method, so examples of adding code to this callback are not given.
When the dialog is in Create mode the dialog memory values are set equal to the current dialog values just after the execution of the Ok callback.
Apply
Required callback. Called to respond to the user hitting the standard Apply navigator button. The standard behavior is for your application to perform the designed actions (such as creating geometry) using the current dialog values but to leave the dialog open. The user is then able to enter new values and perform another Apply without exiting the dialog. An example of this callback is given in Block Styler Selection Blocks.
When the dialog is in Create mode the dialog memory values are set equal to the current dialog values just after the execution of the Apply callback.
Note: After the Apply callback is executed the dialog is actually reinitialized. Therefore, the Initialize callback will be called after the Apply callback executes.
Cancel
Called to respond to the user hitting the standard Cancel navigator button. It is also called if the dialog closes for any other reason, such as the user hitting the Close button in the dialog Rail Clip. The standard behavior is for your application to exit the dialog without making any further modifications to the NX data model — that is, an Apply should not be done, but any previous Applies will not be undone.
DialogShown
Called just before the dialog is displayed. (If you are transitioning from UI Styler, DialogShown() is similar to the post-constructor callback.) Dialog values set in this callback replace dialog memory values for this instance of the dialog. Remember, dialog values set in the callback do not overwrite the dialog memory values unless you click OK or Apply on the dialog.
Initialize
Required callback. The Initialize method is called whenever the dialog is initialized, which is in the following three cases:
- Just after the dialog is first constructed.
- After an Apply is executed (the dialog is reinitialized after Apply, so Initialize runs again).
- (a third re-initialization case — see the parent "Block Styler Memory and Callbacks" page and "Dialog Memory" sub-page for full detail on dialog memory semantics across these cases.)
Use member variable references in your callback code to get and set current dialog values.
Related Topics
- Block Styler Memory and Callbacks
- Standard Navigator Buttons
- Dialog Memory
- Dialog Values
- Dialog Value Example
Source: https://docs.sw.siemens.com/en-US/doc/209349590/PL20220512394070742.nxopen_prog_guide/genid_callbacks_65_4258 · retrieved 2026-07-07