• 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. How to store values for the form fields

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 142
  • Views 9805
  • 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

How to store values for the form fields

yankunRen
yankunRen over 3 years ago

Hi All

    I have the following problem while writing SKILL. (IC616)

    Q1: How do i store the last used field value here in the following function?  I would like use the last used Library again when i go back to the form field so that i dont have to type in every time.

    Q2: How to change the size of Options form, it's too long. And remove the "Last" "Defaults" button.

    Q3: How to use ?doneProc in enterBox(), I want to keep using enterBox() function until I press ESC.

press  F3  Form:

Here is part of the code

Code:

procedure(test()
let(()
cv=geGetEditCellView()
optionsForm = hiCreateOptionsForm(
'optionsForm
"Options"
list(
Type = hiCreateRadioField(
?name 'Type
?prompt "Type"
?choices list("type1" "type2")
);end Type
);end list
nil
);end optionsForm

box = enterBox(
?form eval(optionsForm)
;?doneProc
)
printf("%L\n" box)
if(optionsForm->Type->value == "type1" then printf("%L\n" car(box)))
if(optionsForm->Type->value == "type2" then printf("%L\n" cadr(box)))
);end let
);end procedure

hiSetBindKey("Layout" "<Key>z" "test()")

Thank you all!

Regards,

yankun

  • Cancel
  • Andrew Beckett
    Andrew Beckett over 3 years ago

    Hi Yankun,

    I updated the code (with comments) to show how to achieve the three questions you had. See below. The key changes are:

    1. Check to see if the form already exists - that means it will remember current settings on the form rather than creating fresh each time
    2. Change to use hiCreateAppForm as this has more options - such as the ability to set the buttonLayout and the initialSize
    3. Move the action into the doneProc and give an example of that. It seems that enterBox does not honour the "repeat commands" in the layout editor, so I have emulated it in the doneProc.

    Andrew

    procedure(testDoneProc(wid done box)
      ;----------------------------------------------------------------------
      ; don't do anything if cancelled
      ;----------------------------------------------------------------------
      when(done
        printf("%L\n" box)
        if(optionsForm->Type->value == "type1" then printf("%L\n" car(box)))
        if(optionsForm->Type->value == "type2" then printf("%L\n" cadr(box)))
        ;--------------------------------------------------------------------
        ; enterBox doesn't seem to honour modalCommands itself ("Repeat Commands"
        ; on the Editor Options form) so achieve the same thing
        ; by enqueuing the original command again
        ;--------------------------------------------------------------------
        when(envGetVal("layout" "modalCommands")
          hiEnqueueCmd("test()")
        )
      )
    )
    procedure(test()
      let((optionsForm box)
        cv=geGetEditCellView()
        ;--------------------------------------------------------------------
        ; Only create the form if it doesn't exist already; always
        ; stored in a global variable, so make sure the name is unique
        ;--------------------------------------------------------------------
        unless(boundp('CCFuniqueOptionsForm)
          ;------------------------------------------------------------------
          ; hiCreateAppForm has more control than hiCreateOptionsForm
          ;------------------------------------------------------------------
          hiCreateAppForm(
            ?name 'CCFuniqueOptionsForm
            ?formTitle "Options"
            ?formType 'options
            ?fields list(
              hiCreateRadioField(
                ?name 'Type
                ?prompt "Type"
                ?choices list("type1" "type2")
              );end Type 
            );end list
            ;----------------------------------------------------------------
            ; Control buttons and initial form size
            ;----------------------------------------------------------------
            ?buttonLayout 'HideCancelDef
            ?initialSize 300:60
          );end optionsForm
        )
        optionsForm=CCFuniqueOptionsForm
    
        ;--------------------------------------------------------------------
        ; Moved the processing into the doneProc
        ;--------------------------------------------------------------------
        box = enterBox(
          ?form eval(optionsForm)
          ?doneProc "testDoneProc"
        )
      );end let
    );end procedure
    
    hiSetBindKey("Layout" "<Key>z" "test()")
    
    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • yankunRen
    yankunRen over 3 years ago in reply to Andrew Beckett

    Thank you Andrew,

    That is exactly what i need.

    Thank you very much.

    Best regards,

    Yankun

    • 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