Block UI Styler > Dialog > Code Generation tab
Dialog dialog box — Code Generation tab
This is the reference page for the Block UI Styler's Code Generation tab (inside the Dialog dialog box), which is where a .dlx layout gets turned into a language-specific NX Open code template with wired-up dialog callback stubs. This page enumerates the actual property names and callback names as used by the tool.
General
| Property | Description |
|---|---|
| Language | Lets you select one of the following languages for code generation: C#, C++, Java, Python, VB.NET, VB.NET for SNAP. Right-click to select the language of your choice from a menu. |
| Generate Comment | Generates comments in the template code when you set the option to True. |
| Generate Block Specific Code | Generates code to access block-specific properties using the static block property APIs. |
Entry Points
The following descriptions are for options set to True.
| Entry point | Description |
|---|---|
| Callback | Indicates that the entry point of the dialog box is controlled by a callback. The callback could be a command button in another dialog box. |
| Menu | Indicates that the entry point of the dialog box is from a menu. |
| User Exit | Indicates the entry point launches from a user exit. |
Dialog Callbacks
The following descriptions are for options set to True. (Source refers to "For more details, see Callbacks" — a separate Callbacks reference page in the book, not separately fetched in this pass.)
This is the authoritative, documented list of Block UI Styler dialog callback names and when each fires:
| Callback | Fires when |
|---|---|
| Filter | Invoked when selection is attempted on any object. This callback is only used for selection blocks. |
| Update | Invoked when the block is updated. |
| OK | Invoked when the OK button is clicked in the dialog box. |
| Apply | Invoked when the Apply button is clicked in the dialog box. This option is set to True and cannot be changed (i.e., Apply is always generated). |
| Cancel | Invoked when the Cancel button is clicked in the dialog box. |
| Initialize | Invoked during the initialization of the dialog box. This option is set to True and cannot be changed (i.e., Initialize is always generated). |
| Dialog Shown | Invoked before the dialog box is displayed. |
| Focus Notify | Invoked when the block is in focus. Used only for blocks that do not allow keyboard entries — for example, Selection blocks. |
| Keyboard Focus Notify | Invoked when the block receives focus. Used only for blocks that do allow keyboard entries — for example, Integer or Double blocks. |
| Enable OK/Apply Button | Invoked by the dialog, requesting whether to enable the OK and Apply buttons. |
Notes on callback naming vs. common NX Open convention
The Code Generation tab labels these as Filter, Update, OK, Apply, Cancel, Initialize, Dialog Shown, Focus Notify, Keyboard Focus Notify, and Enable OK/Apply Button — these are the UI labels in the Dialog box's Code Generation tab checklist. In generated code (per NX Open convention referenced elsewhere in the book, e.g. the NX Open Programmer's Guide chapter on Block Styler) these typically surface as method names such as initialize_cb(), apply_cb(), update_cb(block), dialogShown_cb(), ok_cb(), cancel_cb(), enableButton_cb(), and a selection filter_cb(...) — the exact generated signatures depend on the selected Language. This page only documents the tab's own option labels and firing conditions as literally stated in the source; it does not show generated code line-by-line.
Always-on callbacks
Two callbacks are hard-wired to True and cannot be turned off in the generator: Apply and Initialize. Every generated dialog therefore always includes an Apply handler and an Initialize handler regardless of the checkbox states for the others.
Selection-only vs. keyboard-only callbacks
- Filter only fires/is only relevant for Selection blocks (selection-attempt interception).
- Focus Notify is used only for blocks that do not accept keyboard entry (Selection blocks).
- Keyboard Focus Notify is used only for blocks that do accept keyboard entry (e.g., Integer, Double blocks).
This means the same dialog can generate different subsets of focus-related callbacks per block depending on whether the block is a selection-style control or a text/number-entry control.
See also
- Block UI Styler Code Generation (overview page — languages supported: C#, C++, Java, VB.NET, Python; located at Dialog dialog box → Code Generation tab)
- Static APIs for block property
Source: https://docs.sw.siemens.com/en-US/doc/209349590/PL20220512394070742.blockstyler/bs_code_gen_op · retrieved 2026-07-07