• 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 20358
  • 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
Parents
  • 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
Reply
  • 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
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