Product Documentation
Virtuoso Studio Design Environment SKILL Reference
Product Version IC23.1, November 2023

ddsFileBrowseCB

ddsFileBrowseCB( 
g_form
s_targetName
[ t_filter ] 
[ s_mode ] 
[ t_caption ] 
)
=> t / nil

Description

Creates a file browser dialog for specifying file names through browsing.

The given name will be pasted into the target string field upon clicking the OK or Apply button. The dialog can filter files when first displayed. To navigate up or down in the directory structure, either double-click a directory name, or select it and click OK or Apply. The mode option allows checking for existing files.

Arguments

g_form

Accepts a form or a page from a tab field.

s_targetName

The full path name specified as a symbol.

t_filter

Optional string argument which filters file names by using an asterisk at the beginning. Default is no filter.

s_mode

The selection mode specified as a symbol with the following choices:

    • 'anyFile: selection is any file, whether it exists or not
    • 'existingFile: selection is a single file (default)
    • 'directory: selection must be a directory where both files and directories are displayed
    • 'directoryOnly: selection must be a directory where only directories are displayed

The 'existingFiles mode is not supported.

t_caption

Optional argument that allows changing the title of the dialog box that is created. Default is "Unix Browser".

Value Returned

t

The dialog executes successfully.

nil

The dialog encounters an error during execution.

Examples

This example creates a Browse button to open an ASCII Technology file.

;; target file name field
tcAsciiTFStr = hiCreateStringField(
  ?name 'tcAsciiTFStr
  ?prompt "ASCII Technology File"
  ?value ""
)
;; Browse button for selecting an existing file
tcOpenBrowserBtn = hiCreateFormButton(
  ?name 'tcOpenBrowserBtn
  ?buttonText "Browse..."
  ?callback "ddsFileBrowseCB( hiGetCurrentForm()   
    'tcAsciiTFStr \"*.tf\" 'existingFile )" ;open 
)

This example creates a browse button for selecting a library. The browse button is placed in a HI Tab field. The eval function has been used to seed the proper argument for ddsSyncWithForm.

libBrowseBtn = hiCreateFormButton(
   ?name 'libBrowseBtn
   ?buttonText "Browse..."
   ?callback "ddsSyncWithForm(eval(browseForm->tabs->page1) 'libname 'libname)"
  )
; Create a browse button for selecting a file. This browse button is placed in a HI Tab field. 
        field2 = hiCreateStringField( ?name 'filename ?prompt "File Name")
        fileBrowseBtn = hiCreateFormButton(
            ?name 'fileBrowseBtn
            ?buttonText "Browse..."
            ?callback "ddsFileBrowseCB(browseForm->tabs->page1 'filename)"
        )
     
; Create a HI Tab field where the previous browse fields are placed within it.
        tabs = hiCreateTabField(
            ?name 'tabs
            ?notebookStyle 'nil 
            ?tabPlacement 'top 
            ?tabs list("TEST")
            ?value 1
            ?fields list( list(
                list(field1 0:0 200:0 100)
                list(libBrowseBtn 210:0 80:30)
                list(field2 0:40 200:0 100)
                list(fileBrowseBtn 210:40 80:30))
            )
        )
        hiCreateAppForm(
            ?name    'browseForm
            ?formTitle "Example Form"
            ?callback    ""
            ?dontBlock t
            ?fields    list(list(tabs 0:0 300:100))
        )

Related Topics

ddsSyncWithForm

Return to top
 ⠀
X