Showing results for 
Search instead for 
Did you mean: 

block styler FileSelection

Honored Contributor
Honored Contributor

I'm working on a block styler dialog with a "file selection with browse" block. My intention is to allow the user to select an existing text file or key in a name for a new file, select some objects, then write the info to the file when OK is pressed. However, if a new file name is keyed in, an error message pops up saying that the file doesn't exist. This isn't really a problem for me, as it will be created later. The error won't let you continue and I see no option for turning off this validation. How can I use the file browse block to allow the user to key in a path for a new file to be created later?


Re: block styler FileSelection

Siemens Phenom Siemens Phenom
Siemens Phenom

Unfortunately, that is a (frustrating) limitation of the file selection block. Please file an ER to have this behavior changed.


The only workaround I know of using block styler is to use a Folder Selection with Browse block in conjunction with a string block. The user selects the folder with the folder selection block, then types in the name of the file in the string block. You code combines the two to produce a filename. You would also have to manually validate for disallowed characters, etc.


You could also pop-up a separate file selector with an action button using tools in your programming language (i.e. System.Windows.Forms in .NET; Tk in Python, etc.)

Re: block styler FileSelection

Honored Contributor
Honored Contributor


Thanks for the confirmation and suggestions.

Re: block styler FileSelection


Inside the callback for an action button you could use the wrapper for UF_UI_create_filebox():

UFUi.CreateFileboxData createFilebox(String promptString,
                                   String titleString,
                                   String filterString,
                                   String defaultName)
                                             throws NXException,

This handles non-existing files OK. I ususally style the button with a 'open file' bitmap.

Graham Inchley Snr R&D Engineer (Systems Development), Sandvik Coromant
Lenovo ThinkPad W540, Win7, 16GB. Developing in: Java | C | KF
Production: [NX8.5.3.3 MP11 64bit] Testing: [NX11.0.2.7 MP5] & [NX12.0.0.27 MP1]