• 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. List Box Field Contents Not Updating

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 7768
  • 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

List Box Field Contents Not Updating

Pipahhhhhh
Pipahhhhhh over 2 years ago

Hi there,

In the code below, I have a list box field and a button. When I press the button, I want it to add the string "Goodbye" to the list box in the GUI, but it doesn't. When I print a copy of myListBox~>choices though, the "choices" list has the updated contents in it. Why is this? I'm fairly sure that SKILL by default is pass by reference, so the callback procedure that I use should inevitably change the right list. I think I'm missing something fairly obvious here, but I can't figure it out for some reason.

Thanks in advance!

procedure( example()

myListBox = hiCreateListBoxField(
?name gensym( 'TheListBox )
?choices list( "Hello" )
)

myListBoxEntry = list( myListBox 25:25 100:100 )

myButton = hiCreateButton(
?name gensym( 'TheButton )
?callback "buttonCallback( myListBox )"
?buttonText "Turbo Encabulate"
)

myButtonEntry = list( myButton 150:20 125:125 )

myForm = hiCreateAppForm(
?name gensym( 'TheForm )
?fields list( myListBoxEntry myButtonEntry )
)

hiDisplayForm( myForm )

printf( "%L" myForm~>TheListBox~>choices )

)

procedure( buttonCallback( listBox )

printf( "%s%L" "\n\nBefore: " listBox~>choices )

listBox~>choices = cons( "Goodbye" listBox~>choices )

printf( "%s%L" "\n\nAfter: " listBox~>choices )


)

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 2 years ago

    The issue is that you're passing the listBox structure without it being instantiated in the form and you really need that information for it all to work properly. Because the listBox field name itself is generated with a gensym, that complicates matters slightly - but it's pretty easy to get working - just pass the form and the generated field name to the callback function. This also has the benefit of not being dependent upon the form being blocking (in your current code, TheListBox is only in scope because the hiDisplayForm has blocked the code and so it can still see the variableTheListBox).

    procedure( example()
    
      myListBox = hiCreateListBoxField(
        ?name gensym( 'TheListBox )
        ?choices list( "Hello" )
      )
    
      myListBoxEntry = list( myListBox 25:25 100:100 )
    
      myButton = hiCreateButton(
        ?name gensym( 'TheButton )
        ?callback lsprintf("buttonCallback(hiGetCurrentForm() '%s )" myListBox->hiFieldSym)
        ?buttonText "Turbo Encabulate" 
      )
    
      myButtonEntry = list( myButton 150:20 125:125 )
    
      myForm = hiCreateAppForm(
        ?name gensym( 'TheForm ) 
        ?fields list( myListBoxEntry myButtonEntry ) 
      ) 
    
      hiDisplayForm( myForm )
    
    ; doesn't make sense since the field is not called TheListBox
    ;  printf( "%L" myForm~>TheListBox~>choices )
    
    )
    
    procedure( buttonCallback( form listBoxName )
      let((listBox)
        listBox=get(form listBoxName)
        printf( "%s%L" "\n\nBefore: " listBox~>choices )
    
        listBox~>choices = cons( "Goodbye" listBox~>choices )
    
        printf( "%s%L" "\n\nAfter: " listBox~>choices )
    
      )
    )
    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • Pipahhhhhh
    Pipahhhhhh over 2 years ago in reply to Andrew Beckett

    That Was it! Thanks a lot Andrew! I've read a lot of your other posts too, and they've been super helpful to me in learning SKILL.

    All the best,

    Austin

    • 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