• 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. Form like "Add instance" in schematic

Stats

  • Locked Locked
  • Replies 4
  • Subscribers 143
  • Views 2099
  • 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

Form like "Add instance" in schematic

Martinsh
Martinsh over 2 years ago

Dear Sir,

If we add an instances "port" from analogLib to a schematic window, many parameter fields appeared in the Form of  "Add instances". There is a field named "Display second sinusoid". If we check the field box, more parameter fields displayed under the "Display second sinusoid" field. If we cancel the check box, they disappear. How to realize this feature with skill code?

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    Before spending time answering two possible meanings to this question, are you asking how to create a component that works this way with the create instance/edit properties forms (i.e. how to set up the CDF appropriately), or are you asking how to create a SKILL form which has similar functionality with fields that are hidden or not depending on the value of a checkbox on the form?

    I'd like to answer the question you really want the answer to rather than both...

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Martinsh
    Martinsh over 2 years ago in reply to Andrew Beckett

    Andrew,

    Sorry for my unclear post. My question is the second one, how to control hidden/display of the fields by a checkbox.

    Regards,

    Martin

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago in reply to Martinsh

    Martin,

    Here's an example. It shows two ways - one using a boolean button with a callback to control visibility of fields, and the more modern way of using progressive disclosure (which behaves better in my opinion):

    procedure(CCFdisclosureExCreateForm()
        let((fieldA fieldB fieldC fieldD labelA labelB labelC labelD 
                showFirstSet discloseSecondSet)
            fieldA=hiCreateStringField(
                ?name 'fieldA
                ?invisible t
            )
            fieldB=hiCreateStringField(
                ?name 'fieldB
                ?invisible t
            )
            fieldC=hiCreateStringField(
                ?name 'fieldC
            )
            fieldD=hiCreateStringField(
                ?name 'fieldD
            )
            labelA=hiCreateLabel(
                ?name 'labelA
                ?labelText "Field A"
                ?justification 'right
                ?invisible t
            )
            labelB=hiCreateLabel(
                ?name 'labelB
                ?labelText "Field B"
                ?justification 'right
                ?invisible t
            )
            labelC=hiCreateLabel(
                ?name 'labelC
                ?labelText "Field C"
                ?justification 'right
            )
            labelD=hiCreateLabel(
                ?name 'labelD
                ?labelText "Field D"
                ?justification 'right
            )
            ; old school way of creating progressive disclosure - use
            ; a checkbox with a callback that controls visibility 
            ; of fields
            showFirstSet=hiCreateBooleanButton(
                ?name 'showFirstSet
                ?buttonText " "
                ?callback 
                    lambda((_field scope value)
                        scope->labelA->invisible=!value
                        scope->fieldA->invisible=!value
                        scope->labelB->invisible=!value
                        scope->fieldB->invisible=!value
                    )
            )
            showFirstSetLabel=hiCreateLabel(
                ?name 'showFirstSetLabel
                ?labelText "First Set"
                ?justification 'right
            )
            ; modern way of doing it - using progressive 
            ; disclosure
            disclosureSecondSet=hiCreateDisclosureTriangle(
                ?name 'disclosureSecondSet
                ?labelText "Second Set"
                ?onFields 
                    list(
                        'labelC 'fieldC 'labelD 'fieldD
                    )
            )
            grid=hiCreateGridLayout(
                'grid
                ?items list(
                    list(showFirstSetLabel 'row 0 'col 0)
                    list(showFirstSet 'row 0 'col 1)
                    list(labelA 'row 1 'col 0)
                    list(fieldA 'row 1 'col 1)
                    list(labelB 'row 2 'col 0)
                    list(fieldB 'row 2 'col 1)
                    list(disclosureSecondSet 'row 3 'col 0)
                    list(labelC 'row 4 'col 0)
                    list(fieldC 'row 4 'col 1)
                    list(labelD 'row 5 'col 0)
                    list(fieldD 'row 5 'col 1)
                    list('col_stretch 0 0)
                    list('col_stretch 1 1)
                )
            )
            hiCreateLayoutForm(
                'CCFdisclosureExForm
                "Disclosure Example"
                hiCreateVerticalBoxLayout(
                    'vbox
                    ?items list(
                        grid
                        list('stretch_item 1)
                    )
                )
                ; get initial size roughly right to 
                ; avoid scroll bars 
                ?initialSize 300:160
            )
        )
    )
    
    procedure(CCFdisclosureEx()
        ; avoid creating the form every time
        unless(boundp('CCFdisclosureExForm)
            CCFdisclosureExCreateForm()
        )
        ; uses inSkill so that this works if file has a .ils suffix
        hiDisplayForm(inSkill(CCFdisclosureExForm))
    )
    
    
    

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Martinsh
    Martinsh over 2 years ago in reply to Andrew Beckett

    Andrew,

    Thanks a lot.

    Regards,

    Martin

    • 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