• 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. loading scripts using callback function

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 142
  • Views 14068
  • 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

loading scripts using callback function

deep242003
deep242003 over 10 years ago

hi ,

 I want to create a form with some button . Clicking on button should load correponding .il file .

Please suggest how to pass load ("locaton .il" to call back function of hiCreateButtonBoxField.

  • Cancel
  • skillUser
    skillUser over 10 years ago

    Ideally you would provide more detail in your question so that others can help you better.  However, here's an approach using a form with a filename field and an OK / Cancel set of buttons.  The example was written for the purpose of loading a cdsSession.save file, but you can adapt it to your needs...

    
    /***************************************************************
    *                                                              *
    *                       CCSloadSession()                       *
    * A procedure to create a form for loading session files, both *
    *  the filename field and the form have callbacks associated   *
    *  with them.  The form is built the first time this function  *
    *            is called, and then it is displayed.              *
    *                                                              *
    ***************************************************************/
    procedure(CCSloadSession()
      let((filename form)
        unless(boundp('CCSloadSessionForm) && (form=CCSloadSessionForm)
            && hiIsForm(form)
          filename = hiCreateStringField(
                       ?name   'filename
                       ?prompt "File Name"
                       ?value  "cdsSession.save"
                       ?callback "CCSloadSessionFieldCB(hiGetCurrentForm())"
                     )
          form = hiCreateAppForm(
                    ?name      'CCSloadSessionForm
                    ?formTitle "Load Session"
                    ?buttonLayout 'OKCancel
                    ?fields    list(
                      list(filename 0:0 300:30 75) )
                    ?callback  'CCSloadSessionFileCB
                    ?unmapAfterCB t
                 )
        ); unless
        hiDisplayForm(form)
      ); let
    ); procedure CCSloadSession
    
    
    /****************************************************************
    *                                                               *
    *                 CCSloadSessionFieldCB(r_form)                 *
    *  A callback function that tests if the filename field on the  *
    * Load Session form is a valid file or not.  If the file is not *
    *  valid the field is highlighted, otherwise the field appears  *
    *      normal.  This function returns the filename or nil.      *
    *                                                               *
    ****************************************************************/
    procedure(CCSloadSessionFieldCB(form "r")
      let((filename)
        if(isFile(filename=simplifyFilename(form->filename->value)) then
          hiHighlightField(form 'filename 'background)
          filename
        else
          hiHighlightField(form 'filename 'error)
          nil
        ); if
      ); let
    ); procedure CCSloadSessionFieldCB
    
    
    /***************************************************************
    *                                                              *
    *                 CCSloadSessionFileCB(r_form)                 *
    * A callback function that first tests if the filename exists, *
    *   if not the form unmap is vetoed, the form remains on the   *
    *   screen with the filename field highlighted.  If the file   *
    *   does exist the filename field will appear normal and the   *
    *                       file is loaded.                        *
    *                                                              *
    ***************************************************************/
    procedure(CCSloadSessionFileCB(form "r")
    let((file)
      when(hiIsForm(form)
        if(file = CCSloadSessionFieldCB(form) then
          hiSetCallbackStatus(form t)
          hiHighlightField(form 'filename 'background)
          CCSloadSessionFile(file)
        else
          hiSetCallbackStatus(form nil)
          hiHighlightField(form 'filename 'error)
        );if
      );when
    );let
    ); procedure CCSloadSessionFileCB
    
    
    /***************************************************************
    *                                                              *
    *                  CCSloadSessionFile(t_file)                  *
    * This function prints the filename and uses loadi to load it  *
    *                                                              *
    ***************************************************************/
    procedure(CCSloadSessionFile(file "t")
      printf("Loading file: %s\n" file)
      loadi(file)
    ); procedure CCSloadSessionFile
    
    

    Here the OK button applies the form callback which loads the file if it exists. In your case it sounds as though the button would load a file, either a fixed filename, or perhaps another field's string value?

    Hopefully this helps?

    Regards,

    Lawrence.

    • 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