• 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. Variable number of widgets

Stats

  • Locked Locked
  • Replies 5
  • Subscribers 143
  • Views 13693
  • 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

Variable number of widgets

Merfman
Merfman over 14 years ago

Hi, I just found this resource and couldn't be happier! 

I'm trying to create an application that reads a setup file and creates an input menu based on the number of entries in the setup file.  What I've attempted doesn't work.  Code snippet follows: 

 bButton = declare(bButton[20])
  i = 0
  while(i < iConnIndex
   bButton[i] = hiCreateBooleanButton(
    ?name 'bButton[i]
    ?buttonText "Use Layer:"
    ?callback "nil"
    ?value t
   );hCBB
  i++
 );while

 When I run this snippet, I get the following error message: 

*Error* hiCreateBooleanButton: argument for keyword ?name should be a symbol (type template = "sgggtggggs") - bButton[i]

 

So, my questions are open: 

1) Am I missing something simple or is this just not doable? 

2) Is there an established way of accomplishing the same and I'm just using the most difficult method? 

 

Any and all help would be greatly appreciated!  

Thanks in advance, 

Ken Murphy

 

  • Cancel
Parents
  • skillUser
    skillUser over 14 years ago

    Hi Ken,

    Hopefully it is something simple (1) - in your code you have 'bButton[i] - the single quote ' prevents the evaluation of anything that follows, so the array index would not evaluate.  I'm not sure why you declare an array for this, it should not be needed?  Anyway, one method to achieve what you want is to create the symbol for storing the button structure by using concat to join the name base and the integer to form the symbol name, e.g. concat('bButton i) - the "i" is unquoted so that it will evaluate to 0, 1, 2 etc.

    Another method (2) for creating unique symbol names that do not clash is to use gensym - this can be given a base name as in the above concat example: gensym('bButton) - so if you do not need to know or control the name of this symbol/variable, then this approach would work also.  Without more code context I don't know if this approach would suit your needs in this case.

    I hope this answers your question and helps you get this working.

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • skillUser
    skillUser over 14 years ago

    Hi Ken,

    Hopefully it is something simple (1) - in your code you have 'bButton[i] - the single quote ' prevents the evaluation of anything that follows, so the array index would not evaluate.  I'm not sure why you declare an array for this, it should not be needed?  Anyway, one method to achieve what you want is to create the symbol for storing the button structure by using concat to join the name base and the integer to form the symbol name, e.g. concat('bButton i) - the "i" is unquoted so that it will evaluate to 0, 1, 2 etc.

    Another method (2) for creating unique symbol names that do not clash is to use gensym - this can be given a base name as in the above concat example: gensym('bButton) - so if you do not need to know or control the name of this symbol/variable, then this approach would work also.  Without more code context I don't know if this approach would suit your needs in this case.

    I hope this answers your question and helps you get this working.

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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