• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. Skill form to browse text file, select and view

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 16411
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Skill form to browse text file, select and view

Sandeep4386
Sandeep4386 over 10 years ago

Hi All,

Could anyone guide me how I can write a callback function for  a view button on a skill form? When I click this view button, I would like to browse and select multiple text files from UNIX directory structure and  then view them  using Virtuoso text viewer. 

I am using IC616

Regards,

Sandeep

  • Cancel
  • skillUser
    skillUser over 10 years ago

    Hi Sandeep,

    The key to this could be the ddsFileBrowseCB() function, but here's a fully working example:

    
    procedure(CCFviewFile()
      let( (fileName selectFile viewFile form)
        fileName = hiCreateStringField(
          ?name             'fileName
          ?prompt           "File to View"
        )
        selectFile = hiCreateButton(
          ?name             'selectFile
          ?buttonText       "Select File"
          ?callback         "ddsFileBrowseCB(hiGetCurrentForm() 'fileName)"
        )
        viewFile = hiCreateButton(
          ?name             'viewFile
          ?buttonText       "View File"
          ?callback         "view(hiGetCurrentForm()->fileName->value)"
        )
        form = hiCreateAppForm(
          ?name             'CCFviewFileForm
          ?formTitle        "Select file to view"
          ?buttonLayout     'OKCancel
          ?fields           list(
            list(fileName   0:0 400:hicLineHeight   100)
            list(selectFile 100:hicLineHeight 100:hicLineHeight)
            list(viewFile   100:hicLineHeight*2 100:hicLineHeight)
          )
        )
        hiDisplayForm(form)
      ); let
    ); procedure CCFviewFile
    

    Load the code and invoke using "CCFviewFile()"

    Hopefully this is what you were looking for?

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 10 years ago
    Thanks a lot Lawrence. This is exactly what I was looking for. However this would allow me to select and view only one file at a time. Can I select and view multiple files?
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 10 years ago

    Hi Sandeep,

    Ok, here's a different approach, "one button to do it all" - reminds me of Lord Of The Rings ;-)

    
    procedure(CCFviewFile()
      let( (selectFile form)
        selectFile = hiCreateButton(
          ?name             'selectFile
          ?buttonText       "Select File"
          ?callback         strcat("hiDisplayFileDialog(?dialogName 'CCFselectFile"
            " ?mode 'existingFiles ?caption \"Select one or more files\""
            " ?callback \"CCFviewFileCB\")")
        )
        selectFile->hiToolTip = "Browse for file(s) to view"
        form = hiCreateAppForm(
          ?name             'CCFviewFileForm
          ?formTitle        "Select files to view"
          ?buttonLayout     'OKCancel
          ?fields           list(list(selectFile 0:0 100:hicLineHeight))
        )
        hiDisplayForm(form)
      ); let
    ); procedure CCFviewFile
    
    procedure(CCFviewFileCB(dialog event)
      when(event=='done
        foreach(file hiFileDialogSelection(dialog)
          when(isFile(buildString(file "/")) view(buildString(file "/")) )
        ); foreach
      ); when
    ); procedure CCFviewFileCB
    
    

    This uses the hiDisplayFileDialog() function to allow one or more files to be selected and the callback is invoked from the file selection dialog Open button - the callback handles the viewing of each file.

    Best regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Sandeep4386
    Sandeep4386 over 10 years ago
    Thank you very much Lawrence. Thant worked like a charm!
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information