• 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 GUI radio button

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 146
  • Views 14197
  • 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 GUI radio button

mjgoh
mjgoh over 4 years ago

Hi, I have problem on the radio button. The AddField and DeleteField doesn't work when I create multiple RadioField.

Anyone can help? The code work well for single RaioField.

procedure(Form()
let((libName LayerRadio ViaRadio sep1 sep2)
libName=hiCreateStringField(
?name 'libName
?prompt "Library Name"
?callback "ddsUpdateSyncWithForm()"
)

sep1=hiCreateSeparatorField(?name 'sep1)

LayerRadio=hiCreateRadioField(
?name 'layerradio
?prompt "Layer Options"
?choices list("Copy" "Replace" "Remove" "none")
?value "none"
?defValue "none"
?callback list("oferLayerRadioButtonCB()")
)

sep2=hiCreateSeparatorField(?name 'sep2)

ViaRadio=hiCreateRadioField(
?name 'viaradio
?prompt "Via Options"
?choices list("Copy" "Replace" "Remove" "none")
?value "none"
?defValue "none"
?callback list("oferViaRadioButtonCB()")
)


hiCreateAppForm(
?name 'oferExampleForm
?formTitle "Ofer's example form"
?callback 'oferExampleForm
?fields list(libName sep1 LayerRadio sep2 ViaRadio)
)
); let
); procedure Form

procedure(oferLayerRadioButtonCB()

oldLayer=hiCreateStringField(
?name 'oldLayer
?prompt "old Layer"
)
newLayer=hiCreateStringField(
?name 'newLayer
?prompt "new Layer"
)
oferExampleForm->extraFields=list(nil 'oldLayer oldLayer
'newLayer newLayer)
oferExampleForm

let( (radioVal)
radioVal=oferExampleForm->LayerRadio->value

when(radioVal=="none" && oferExampleForm->oldLayer
hiDeleteField(oferExampleForm 'oldLayer))

when(radioVal=="Remove" && oferExampleForm->newLayer
hiDeleteField(oferExampleForm 'newLayer))

when(radioVal=="Copy" || radioVal=="Replace" || radioVal=="Remove"
unless(oferExampleForm->oldLayer
hiAddField(oferExampleForm oldLayer)))

when(radioVal=="Copy" || radioVal=="Replace"
unless(oferExampleForm->newLayer
hiAddField(oferExampleForm newLayer)))


)); procedure oferLayerRadioButtonCB

procedure(oferViaRadioButtonCB()

oldVia=hiCreateStringField(
?name 'oldLayer
?prompt "old Via"
)
newVia=hiCreateStringField(
?name 'newLayer
?prompt "new Via"
)
oferExampleForm->extraFields=list(nil 'oldVia oldVia
'newVia newVia)
oferExampleForm

let( (viaradioVal)
viaradioVal=oferExampleForm->ViaRadio->value

when(viaradioVal=="none" && oferExampleForm->oldVia
hiDeleteField(oferExampleForm 'oldVia))

when(viaradioVal=="Remove" && oferExampleForm->newVia
hiDeleteField(oferExampleForm 'newVia))

when(viaradioVal=="Copy" || viaradioVal=="Replace" || viaradioVal=="Remove"
unless(oferExampleForm->oldVia
hiAddField(oferExampleForm oldVia)))

when(viaradioVal=="Copy" || viaradioVal=="Replace"
unless(oferExampleForm->newVia
hiAddField(oferExampleForm newVia)))
)); procedure oferViaRadioButtonCB


procedure(BEOL()
unless(boundp('oferExampleForm)
Form()
)

hiDisplayForm(oferExampleForm)
)

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago

    The main problem with the code is that you were:

    1. Using oferExampleForm->ViaRadio->value and oferExampleForm->LayerRadio->value when you should have been using oferExampleForm->viaradio->value and oferExampleForm->layerradio->value (you need to use the field names not the variable names) - because of this, your callbacks weren't seeing the value of the radio buttons
    2. You also had the wrong field names when you created the oldVia and newVia fields in the via radio callback (you created them with these variables, but the field names were oldLayer and newLayer, so would have clashed with the fields added by the layer radio callback)

    Your code is a bit messy and has a number of problems which I didn't fix - I'll leave that to you so that you can learn from it (I only fixed the basic flaw above):

    1. Total lack of indentation made it very hard to follow (so I partly re-indented it so I stood some chance of debugging it)
    2. You have the dynamically added fields being created in the callback functions, so they are recreated every time the callback is triggered, which I doubt is what you want. Rather than doing that, perhaps you should create them in the main function and then store them in a disembodied property list for use later (you're storing them in a DPL in the callbacks but not using it anywhere, so that code is a bit redundant)
    3. You are creating the oldVia/newVia/oldLayer/newLayer fields as global variables since they are outside a let.
    4. The logic is wrong - if you click Copy or Replace and then go back to "none" it leaves one of the fields behind. You have to click on Copy, then Remove, then none to make them go away.
    5. Your function names are a bit weird. Obviously you've started from my "oferExample" code but unless you happen to be called "Ofer" (the original example was written for somebody in Israel called Ofer), I can't see why you've kept those function prefixes, or why you have a function called "Form" which is not very likely to be unique.

    Anyway, here's the code with the first level of fixes done (and see how much easier it is to follow with indentation!):

    procedure(Form()
      let((libName LayerRadio ViaRadio sep1 sep2)
        libName=hiCreateStringField(
          ?name 'libName
          ?prompt "Library Name"
          ?callback "ddsUpdateSyncWithForm()"
        )
    
        sep1=hiCreateSeparatorField(?name 'sep1)
    
        LayerRadio=hiCreateRadioField(
          ?name 'layerradio
          ?prompt "Layer Options"
          ?choices list("Copy" "Replace" "Remove" "none")
          ?value "none"
          ?defValue "none"
          ?callback list("oferLayerRadioButtonCB()")
        )
    
        sep2=hiCreateSeparatorField(?name 'sep2)
    
        ViaRadio=hiCreateRadioField(
          ?name 'viaradio
          ?prompt "Via Options"
          ?choices list("Copy" "Replace" "Remove" "none")
          ?value "none"
          ?defValue "none"
          ?callback list("oferViaRadioButtonCB()")
        )
    
    
        hiCreateAppForm(
          ?name 'oferExampleForm
          ?formTitle "Ofer's example form"
          ?callback 'oferExampleForm
          ?fields list(libName sep1 LayerRadio sep2 ViaRadio)
        )
      ); let
    ); procedure Form
    
    procedure(oferLayerRadioButtonCB()
    
      oldLayer=hiCreateStringField(
        ?name 'oldLayer
        ?prompt "old Layer"
      )
      newLayer=hiCreateStringField(
        ?name 'newLayer
        ?prompt "new Layer"
      )
      oferExampleForm->extraFields=list(nil 'oldLayer oldLayer
        'newLayer newLayer)
      oferExampleForm
    
      let( (radioVal)
        ; field is called layerradio not LayerRadio
        radioVal=oferExampleForm->layerradio->value
    
        when(radioVal=="none" && oferExampleForm->oldLayer
          hiDeleteField(oferExampleForm 'oldLayer))
    
        when(radioVal=="Remove" && oferExampleForm->newLayer
          hiDeleteField(oferExampleForm 'newLayer))
    
        when(radioVal=="Copy" || radioVal=="Replace" || radioVal=="Remove"
          unless(oferExampleForm->oldLayer
            hiAddField(oferExampleForm oldLayer)
          )
        )
    
        when(radioVal=="Copy" || radioVal=="Replace"
          unless(oferExampleForm->newLayer
            hiAddField(oferExampleForm newLayer)
          )
        )
    
      )
    ); procedure oferLayerRadioButtonCB
    
    procedure(oferViaRadioButtonCB()
    
      ; the field names where oldLayer and newLayer but should be oldVia and newVia
      oldVia=hiCreateStringField(
        ?name 'oldVia
        ?prompt "old Via"
      )
      newVia=hiCreateStringField(
        ?name 'newVia
        ?prompt "new Via"
      )
      oferExampleForm->extraFields=list(nil 'oldVia oldVia
        'newVia newVia)
      oferExampleForm
    
      let( (viaradioVal)
        ; was using ViaRadio but the field is called viaradio
        viaradioVal=oferExampleForm->viaradio->value
    
        when(viaradioVal=="none" && oferExampleForm->oldVia
          hiDeleteField(oferExampleForm 'oldVia))
    
        when(viaradioVal=="Remove" && oferExampleForm->newVia
          hiDeleteField(oferExampleForm 'newVia))
    
        when(viaradioVal=="Copy" || viaradioVal=="Replace" || viaradioVal=="Remove"
          unless(oferExampleForm->oldVia
            hiAddField(oferExampleForm oldVia)))
    
        when(viaradioVal=="Copy" || viaradioVal=="Replace"
          unless(oferExampleForm->newVia
            hiAddField(oferExampleForm newVia)
          )
        )
      )
    ); procedure oferViaRadioButtonCB
    
    
    procedure(BEOL()
      unless(boundp('oferExampleForm)
        Form()
      )
    
      hiDisplayForm(oferExampleForm)
    )

    Andrew

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • mjgoh
    mjgoh over 4 years ago in reply to Andrew Beckett

    Thanks you so much! I have mix out the field naming. Appreciated your help!

    • 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