• 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. Create GUI to store user input string

Stats

  • Locked Locked
  • Replies 11
  • Subscribers 143
  • Views 20357
  • 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

Create GUI to store user input string

blankman
blankman over 12 years ago
Hi,

I’m looking to create a GUI that takes and stores a number of input strings, ie lib name, cell name etc. I’ve tried using hiDisplayAppDBox, but this only allows for creation of buttons. Is there means of doing this?

Thanks,
Brian.
  • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    Brian,

    Sounds as if you want to know how to create a form - see this generic example I normally point people to.

    Regards,

    Andrew.

     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • blankman
    blankman over 12 years ago

    Thanks Andrew,

    The form I am looking to create is attached, and to have the entered data stored in the local .cdsinit file.

    Looking at your code; I'm trying to call up the "main form" (the oferCreateForm procedure) with a bindkey from the layout window, however I'm not having much joy. Please could you direct me as to how to call/raise the form (my skill knowledge is still quite limited) I should be able to figure the rest from there on then.

    Thanks,
    Brian.

    • Store Quick Launch.jpg
    • View
    • Hide
    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    Hi Brian,

    You want to define your bindkey as:

    hiSetBindKey("Layout" "<Key>n" "oferExample()")

    The function you want to call is oferExample, not oferCreateForm. oferExample() creates the form if needed, then displays it. The definition is at the bottom of the example.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • blankman
    blankman over 12 years ago

    Andrew,

    Thanks.

    Form created using code below.

    How would I then go about saving/writing the selected cellview info (lib cell view) to the local .cdsinit file? I am looking to save and recall the info each time the tool is started, and auto stuff into the form.

    Thanks,
    Brian.

     

     /***************************************************************
    *                     Create the main form                     *
    ***************************************************************/

    procedure(oferCreateForm()
        let((libName1 cellName1 viewName1 browse1 libName2 cellName2 viewName2 browse2 libName3 cellName3 viewName3 browse3 sep1 sep2 sep3)
        ; cellView specification
        libName1=hiCreateStringField(
            ?name 'libName1
            ?prompt "Library Name 1"
            ?callback "ddsUpdateSyncWithForm()"
            )
        cellName1=hiCreateStringField(
            ?name 'cellName1
            ?prompt "Cell Name 1"
            ?callback "ddsUpdateSyncWithForm()"
            )
        viewName1=hiCreateStringField(
            ?name 'viewName1
            ?prompt "View Name 1"
            ?callback "ddsUpdateSyncWithForm()"
            )
        browse1=hiCreateButton(
            ?name 'browse1
            ?buttonText "Browse"
            ?callback "oferSyncBrowser()"
            )
        sep1=hiCreateSeparatorField(?name 'sep1)
        libName2=hiCreateStringField(
            ?name 'libName2
            ?prompt "Library Name 2"
            ?callback "ddsUpdateSyncWithForm()"
            )
        cellName2=hiCreateStringField(
            ?name 'cellName2
            ?prompt "Cell Name 2"
            ?callback "ddsUpdateSyncWithForm()"
            )
        viewName2=hiCreateStringField(
            ?name 'viewName2
            ?prompt "View Name 2"
            ?callback "ddsUpdateSyncWithForm()"
            )
        browse2=hiCreateButton(
            ?name 'browse2
            ?buttonText "Browse"
            ?callback "oferSyncBrowser()"
            )
        sep2=hiCreateSeparatorField(?name 'sep2)
        libName3=hiCreateStringField(
            ?name 'libName3
            ?prompt "Library Name 3"
            ?callback "ddsUpdateSyncWithForm()"
            )
        cellName3=hiCreateStringField(
            ?name 'cellName3
            ?prompt "Cell Name 3"
            ?callback "ddsUpdateSyncWithForm()"
            )
        viewName3=hiCreateStringField(
            ?name 'viewName3
            ?prompt "View Name 3"
            ?callback "ddsUpdateSyncWithForm()"
            )
        browse3=hiCreateButton(
            ?name 'browse3
            ?buttonText "Browse"
            ?callback "oferSyncBrowser()"
            )
        sep3=hiCreateSeparatorField(?name 'sep3)

        hiCreateAppForm(
            ?name 'oferExampleForm
            ?formTitle "Store Cellview Quick Launch"
            ?fields
            list(
                list(libName1 0:40 300:30 100)
                list(cellName1 0:70 300:30 100)
                list(viewName1 0:100 300:30 100)
                list(browse1 200:130 100:25)
                list(sep1 0:165 300:0)
                list(libName2 0:175 300:30 100)
                list(cellName2 0:205 300:30 100)
                list(viewName2 0:235 300:30 100)
                list(browse2 200:265 100:25)
                list(sep2 0:300 300:0)
                list(libName3 0:310 300:30 100)
                list(cellName3 0:340 300:30 100)
                list(viewName3 0:370 300:30 100)
                list(browse3 200:400 100:25)
                ;list(sep3 0:205 600:0)
                )
            )
        oferExampleForm
        )
        )



    /***************************************************************
    *                 Synchronise with the browser
    ***************************************************************/

    procedure(oferSyncBrowser()
        ddsSyncWithForm(
        oferExampleForm
        'browse1
        'libName1
        'cellName1
        'viewName1
        )
        )


    /***************************************************************
    *                       Main entry point
    ***************************************************************/

    procedure(oferExample()
        unless(boundp('oferExampleForm)
        oferCreateForm()
        )
        hiDisplayForm(oferExampleForm)
        )
       
    hiSetBindKey("Command Interpreter" "Ctrl Alt Shift<key>o" "oferExample()")

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 12 years ago

    Brian,

    I updated the code to do several things:

    1. I changed the function names to use a prefix "Brian" rather than "ofer" (Ofer was the name of the person I first put the example together for, and I'm trying to distinguish it for searches on this forum).
    2. I fixed the browse button callbacks - on your form the second and third browse buttons populated the first lib/cell/view fields
    3. I added code to save the form contents to a file in your working dir called "brianFormData", and also to load it from that file when the form is created (i.e. the first time it is run).

    I didn't think it was such a good idea to update the .cdsinit file automatically because that's a manually written file - updating a manually written file automatically is more likely to lead to data loss.

    Anyway, hope it gives some pointers!

    Kind Regards,

    Andrew.

     /***************************************************************
    *                     Create the main form                     *
    ***************************************************************/

    procedure(BrianCreateForm()
        let((libName1 cellName1 viewName1 browse1 libName2 cellName2 viewName2 browse2 libName3 cellName3 viewName3 browse3 sep1 sep2 sep3)
        ; cellView specification
        libName1=hiCreateStringField(
            ?name 'libName1
            ?prompt "Library Name 1"
            ?callback "ddsUpdateSyncWithForm()"
            )
        cellName1=hiCreateStringField(
            ?name 'cellName1
            ?prompt "Cell Name 1"
            ?callback "ddsUpdateSyncWithForm()"
            )
        viewName1=hiCreateStringField(
            ?name 'viewName1
            ?prompt "View Name 1"
            ?callback "ddsUpdateSyncWithForm()"
            )
        browse1=hiCreateButton(
            ?name 'browse1
            ?buttonText "Browse"
            ?callback "BrianSyncBrowser1()"
            )
        sep1=hiCreateSeparatorField(?name 'sep1)
        libName2=hiCreateStringField(
            ?name 'libName2
            ?prompt "Library Name 2"
            ?callback "ddsUpdateSyncWithForm()"
            )
        cellName2=hiCreateStringField(
            ?name 'cellName2
            ?prompt "Cell Name 2"
            ?callback "ddsUpdateSyncWithForm()"
            )
        viewName2=hiCreateStringField(
            ?name 'viewName2
            ?prompt "View Name 2"
            ?callback "ddsUpdateSyncWithForm()"
            )
        browse2=hiCreateButton(
            ?name 'browse2
            ?buttonText "Browse"
            ?callback "BrianSyncBrowser2()"
            )
        sep2=hiCreateSeparatorField(?name 'sep2)
        libName3=hiCreateStringField(
            ?name 'libName3
            ?prompt "Library Name 3"
            ?callback "ddsUpdateSyncWithForm()"
            )
        cellName3=hiCreateStringField(
            ?name 'cellName3
            ?prompt "Cell Name 3"
            ?callback "ddsUpdateSyncWithForm()"
            )
        viewName3=hiCreateStringField(
            ?name 'viewName3
            ?prompt "View Name 3"
            ?callback "ddsUpdateSyncWithForm()"
            )
        browse3=hiCreateButton(
            ?name 'browse3
            ?buttonText "Browse"
            ?callback "BrianSyncBrowser3()"
            )
        sep3=hiCreateSeparatorField(?name 'sep3)

        hiCreateAppForm(
            ?name 'BrianExampleForm
            ?formTitle "Store Cellview Quick Launch"
            ?callback "BrianSaveFormToFile(BrianExampleForm \"./brianFormData\")"
            ?fields
            list(
                list(libName1 0:40 300:30 100)
                list(cellName1 0:70 300:30 100)
                list(viewName1 0:100 300:30 100)
                list(browse1 200:130 100:25)
                list(sep1 0:165 300:0)
                list(libName2 0:175 300:30 100)
                list(cellName2 0:205 300:30 100)
                list(viewName2 0:235 300:30 100)
                list(browse2 200:265 100:25)
                list(sep2 0:300 300:0)
                list(libName3 0:310 300:30 100)
                list(cellName3 0:340 300:30 100)
                list(viewName3 0:370 300:30 100)
                list(browse3 200:400 100:25)
                ;list(sep3 0:205 600:0)
                )
            )
        BrianExampleForm
        )
        )



    /***************************************************************
    *                 Synchronise with the browser
    ***************************************************************/

    procedure(BrianSyncBrowser1()
        ddsSyncWithForm(
            BrianExampleForm
            'browse1
            'libName1
            'cellName1
            'viewName1
        )
    )

    procedure(BrianSyncBrowser2()
        ddsSyncWithForm(
            BrianExampleForm
            'browse2
            'libName2
            'cellName2
            'viewName2
        )
    )

    procedure(BrianSyncBrowser3()
        ddsSyncWithForm(
            BrianExampleForm
            'browse3
            'libName3
            'cellName3
            'viewName3
        )
    )

    procedure(BrianSaveFormToFile(form fileName)
        let((file data)
            file=outfile(fileName)
            if(file then
                data=foreach(mapcar count '(1 2 3)
                    foreach(mapcar fieldRoot '(libName cellName viewName)
                        get(form concat(fieldRoot count))->value
                    )
                )
                pprint(data file)
                newline(file)
                close(file)
                t
            else
                warn("Unable to write to file %L\n" fileName)
            )
        )
    )
           
    procedure(BrianLoadFormFromFile(form fileName)
        let((file data)
            file=infile(fileName)
            if(file then
                data=car(lineread(file))
                foreach((count row) '(1 2 3) data
                    foreach((fieldRoot value) '(libName cellName viewName) row
                        get(form concat(fieldRoot count))->value=value
                    )
                )
                close(file)
                t
            else
                warn("Unable to read from file %L\n" fileName)
            )
        )
    )

    /***************************************************************
    *                       Main entry point
    ***************************************************************/

    procedure(BrianExample()
        unless(boundp('BrianExampleForm)
            BrianCreateForm()
            BrianLoadFormFromFile(BrianExampleForm "./brianFormData")
        )
        hiDisplayForm(BrianExampleForm)
    )
      
    hiSetBindKey("Command Interpreter" "Ctrl Alt Shift<key>o" "BrianExample()")
     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • blankman
    blankman over 12 years ago

    Andrew, thanks, help very much appreciated.

    One last question; I'm hoping now to open the stored cell via bindkey as below. Previously I had set 3 global variables to make this work; BSlibname1 BScellname1 BSviewname1. I’ve tried extracting this data from the code, but without success. How would I go about doing this in this instance?

    Regards,
    Brian.

    hiSetBindKey("Command Interpreter" "Ctrl Alt Shift<key>1" "win1=hiCreateWindow('((1599 0) (3520 1173)) \"graphics\" \"layout_win\" \"\" t) geOpen(?window win1 ?lib BSlibName1 ?cell BScellName1 ?view BSviewName1 ?mode \"r\") hiResizeWindow(win1 list(1599:0 3520:1173)) leResizeLSW(list(1424:0 1595:1178))")

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

    Hi Brian,

    The global variables you mention are not the same as those named in the code:  BSlibname1 BScellname1 BSviewname1 vs. BSlibName1 BScellName1 BSviewName1.

    If the names match (variables, procedures etc. are case sensitive in SKILL) then it should work just fine.

    Regards,

    Lawrence.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • blankman
    blankman over 12 years ago

    Lawrence,

    I tried globalizing the variables libName1 cellName1 viewName1 from the BrianCreateForm procedure, so they could be referenced in the hiCreateWindow command, however in doing so I get the error below.

    *Error* geOpen: argument for keyword ?lib should be a string (type template = "gttttt") - stringStruct@0x1316d2a8

    Was this what you meant?

    Regards,
    Brian.

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

    Hi Brian,

    Not quite - here it appears that you are passing the name of the string field variable; geOpen expects a string value for the lib/cell/view names, so you would need to access the value of the string field, something like BSlibName->value etc. (assuming that the global variable was called BSlibName1).

    Hopefully this will help you.

    Regards,

    Lawrence.

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

    Hi Brian,

    By the way, you don't really need to make the string fields global - the form structure is already global, so you can just access the string fields directly from that.  E.g. BrianExampleForm->libName1->value and so on.  Fewer global variables is better, and generally easier to code with and debug for.

    Best regards,

    Lawrence.

    • 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