• 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. problems about create form

Stats

  • Locked Locked
  • Replies 3
  • Subscribers 143
  • Views 13906
  • 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

problems about create form

nidon2003
nidon2003 over 10 years ago

Hi everyone,

I write a script to create forms as follow:

####################################################

procedure(testCallback(name)
let(()

fieldName=concat(name)
testStringField=hiCreateLabel(
?name fieldName
?labelText strcat("This is test form from " name) )

filedForm = hiCreateAppForm(
?name fieldName
?formTitle "test"
?buttonLayout 'OKCancel
?fields
list(
list(testStringField 0:20 200:40)
)
)

hiDisplayForm(filedForm 650:250)

)
)

procedure(FormTest()
let(()

itemList=nil
hButton=40
yButton=20
for(i 1 10
itemName=concat("test" sprintf(nil "%n" i))
itemText=strcat("test" sprintf(nil "%n" i))
itemCallback=sprintf(nil "testCallback(%L)" itemText)
item=list(
hiCreateFormButton(
?name itemName
?buttonText itemText
?callback itemCallback)
0:yButton+40*(i-1)
410:hButton )
itemList=cons(item itemList)
)

FormTest = hiCreateAppForm(
?name 'FormTest
?formTitle "Form Test"
?buttonLayout 'OKCancel
?fields itemList )

) ;let
) ;

FormTest()
hiDisplayForm(FormTest 350:250)

####################################################

But  it shows two warnings when i run it,

Warning hiDeleteForm: Cannot delete a form that is mapped or form within the form's callback

Warning hiCreateForm: Could not delete already created form.

I can't to solve these warnings, please give me some help.

Thank you very much!

 

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 10 years ago

    The code works fine - I tried it.

    The warnings you are seeing only occur if a form that is being recreated (or attempted to be recreated) is already displayed on the screen at the time you recreate it. You need to OK or cancel the form first before recreating it.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • skillUser
    skillUser over 10 years ago

    Your code has 'let()' statements with no declarations and thus there are no local variables, they all become global.  I've modified the code a little so that it will pass SKILL Lint with a score of 100.

    
    procedure(testCallback(name)
      let((fieldName testStringField filedForm)
    
      fieldName=stringp(name) && concat(name) || name
      testStringField=hiCreateLabel(
        ?name fieldName
        ?labelText strcat("This is test form from " name) )
    
      filedForm = hiCreateAppForm(
        ?name fieldName
        ?formTitle "test"
        ?buttonLayout 'OKCancel
        ?fields list(
                  list(testStringField 0:20 200:40)
                )
      )
    
      hiDisplayForm(filedForm 650:250)
      ); let
    ); procedure testCallback
    
    procedure(FormTest()
      let((item itemList (hButton 40) (yButton 20))
    
        for(i 1 10
          item=list(
            hiCreateFormButton(
              ?name         concat('test i)
              ?buttonText   sprintf(nil "Test %n" i)
              ?callback     sprintf(nil "testCallback(\"test%n\")" i)
            )
            0:yButton+35*(i-1)
            410:hButton
            )
          itemList=cons(item itemList)
        ); for
    
        ;; creates and returns global form variable/structure FormTest
        hiCreateAppForm(
          ?name 'FormTest
          ?formTitle "Form Test"
          ?buttonLayout 'OKCancel
          ?fields itemList
        )
      ); let
    ); procedure FormTest
    
    

    You can use it in the same way as before, or more simply: hiDisplayForm(FormTest() 350:250)

    Regards,
    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • nidon2003
    nidon2003 over 10 years ago

    Thanks for you reply,  Andrew and Lawrence

       As you said above, i found the problem in my code and got a way to solve it. In the new code, if the test form has been created, it will not be recreated again. The whole code as follow:

    ####################################################

    procedure(testCallback(name)
    let((fieldName testStringField filedForm )

    fieldName=concat(name)
    testStringField=hiCreateLabel(
    ?name fieldName
    ?labelText strcat("This is test form from " name) )

    filedForm = hiCreateAppForm(
    ?name fieldName
    ?formTitle "test"
    ?buttonLayout 'OKCancel
    ?fields
    list(
    list(testStringField 0:20 200:40)
    )
    )

    ;; hiDisplayForm(filedForm 650:250)

    )
    )

    procedure(test1(name)
    let((fieldName)

    fieldName=concat(name)
    unless(boundp(fieldName) testCallback(name) )

    hiDisplayForm(filedForm 650:250)

    )
    )

    procedure(FormTest()
    let((itemList hButton yButton itemName itemText itemCallback item)

    itemList=nil
    hButton=40
    yButton=20
    for(i 1 10
    itemName=concat("test" sprintf(nil "%n" i))
    itemText=strcat("test" sprintf(nil "%n" i))
    itemCallback=sprintf(nil "test1(%L)" itemText)
    item=list(
    hiCreateFormButton(
    ?name itemName
    ?buttonText itemText
    ?callback itemCallback)
    0:yButton+40*(i-1)
    410:hButton )
    itemList=cons(item itemList)
    )

    FormTest = hiCreateAppForm(
    ?name 'FormTest
    ?formTitle "Form Test"
    ?buttonLayout 'OKCancel
    ?fields itemList )

    ) ;let
    ) ;

    FormTest()
    hiDisplayForm(FormTest 350:250)

    ####################################################

    Thank you very much!

    • 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