• 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. hiCreateReportField... passing arguments to its callbac...

Stats

  • Locked Locked
  • Replies 10
  • Subscribers 143
  • Views 19052
  • 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

hiCreateReportField... passing arguments to its callback

trandolph
trandolph over 9 years ago

I am using hiCreateReportField and choosing the argument ?callback to find out which row

has been selected. The callback (as shown in the documentation for hiCreateReportField)

function is automatically passed two arguments. The first argument is the field name, the

second argument is a list of integers representing the selected items in the report.

My question is... How can I pass additional variables to my callback function while

keeping the two arguments passed automatically (fieldName selectedItems)?

Cadence doc...

reportField = hiCreateReportField(

...other arguments...

? callback 'reportCB

)

procedure( reportCB(fieldName selectedItems "sl")
  printf( "Report field callback, fieldName = %L, selectedItems = %L"           fieldName selectedItems )
)

  • Cancel
Parents
  • Andrew Beckett
    Andrew Beckett over 9 years ago

    This would never work:

    hiReportGetSelectedItems('theForm~>tabField~>page3~>tabInfo3)

    because the variable with the form is quoted and so not evaluated. Similarly:

    hiReportGetSelectedItems(theForm~>tabField~>page3~>tabInfo3)

    if the form is currently having a string field. However, if your code has switched across to replacing the field with a report field, then it would work fine.

    See the example below. If you run the code (using the line in the comment on the first line) and then go to the third tab. Click on Print Selections and it will show a message in the CIW saying it's a string field. If you click on the Add Field button first, then click on Print Selections you'll see info about whatever is selected.

    ; call hiDisplayForm(abCreateTabForm()) to see the example
    
    procedure(abCreateTabForm()
        let((tabField addField1 addField2 addField3 printSelections tabInfo1 
                tabInfo2 tabInfo3)
            addField1=hiCreateButton(
                ?name 'addField1
                ?buttonText "Do nothing"
            )
            addField2=hiCreateButton(
                ?name 'addField2
                ?buttonText "Do nothing"
            )
            addField3=hiCreateButton(
                ?name 'addField3
                ?buttonText "Add Field"
                ?callback "abAddField(hiGetCurrentForm())"
            )
            printSelections=hiCreateButton(
                ?name 'printSelections
                ?buttonText "Print Selections"
                ?callback "abPrintSelections(hiGetCurrentForm())"
            )
            tabInfo1=hiCreateStringField(
                ?name 'tabInfo1 
                ?prompt "Info"
            )
            tabInfo2=hiCreateStringField(
                ?name 'tabInfo2 
                ?prompt "Info"
            )
            tabInfo3=hiCreateStringField(
                ?name 'tabInfo3 
                ?prompt "Info"
            )
            tabField=hiCreateTabField(
                ?name 'tabField
                ?tabPlacement 'top
                ?value 1
                ?fields 
                    list(
                        list(
                            list(addField1 100:0 200:30)
                            list(tabInfo1 0:30 540:30 100)
                        )
                        list(
                            list(addField2 100:0 200:30)
                            list(tabInfo2 0:30 540:30 100)
                        )
                        list(
                            list(addField3 100:0 200:30)
                            list(printSelections 320:0 200:30)
                            list(tabInfo3 0:30 540:30 100)
                        )
                    )
                ?tabs list("First" "Second" "Third")
            )
            hiCreateAppForm(
                ?name 'abExampleTabForm
                ?formTitle "Tab Form"
                ?fields 
                    list(
                        list(tabField 0:0 800:400 30)
                    )
                ?initialSize t
            )
        )
    )
    
    
    
    procedure(abAddField(theForm)
        let((title_str (error_lay_hilo_number 3) (error_lay_hilo
            list(
                list("albert" "metal1" "drawing" "high" 1.0 2.0)
                list("george" "metal2" "drawing" "low" 3.0 1.0)
                list("harry" "metal3" "drawing" "low" -3.0 5.0)
            )
            ))
        sprintf(title_str "Layout Hierarchical Check Report - %d errors" error_lay_hilo_number)
        hiDeleteField(theForm->tabField->page3 'tabInfo3)
        hiAddField(theForm->tabField->page3 list(hiCreateReportField(
            ?name 'tabInfo3
            ?title title_str
            ?titleAlignment 'center
            ?headers list(
            list("Layout cell name" 300 'left 'string t)
            list("Layer" 40 'left 'string)
            list("Purpose" 60 'left 'string)
            list("Voltage" 60 'left 'string)
            list(" X-coord" 80 'right 'float)
            list(" Y-coods" 80 'right 'float)
            )
            ?choices error_lay_hilo
            ?selectMode 'single
            )
            50:60 700:400 30)
            )
        )
    )
    
    procedure(abPrintSelections(theForm)
        if(theForm->tabField->page3->tabInfo3->fieldType=='report then
            printf("SELECTIONS ARE: %L\n"
                ; I'd probably use -> rather than ~> but it doesn't matter
                hiReportGetSelectedItems(theForm~>tabField~>page3~>tabInfo3)
            )
        else
            printf("FIELD IS CURRENTLY A STRING FIELD\n")
        )
    )
    

    Regards,

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • GP14
    GP14 over 6 years ago in reply to Andrew Beckett

    Hi,

    I am trying to re-do this code so I can create a Tab which has a function of adding and entry of information in the table.

    Is it possible in here skill? Its just like displaying information in every the selected entry 

    For example there exists this table like the table shown above.

               

                list( "LMARK" "metal1" "drawing" "high" 1.0 2.0)
                list("george" "metal2" "drawing" "low" 3.0 1.0)
                list("harry" "metal3" "drawing" "low" -3.0 5.0)

    I would like to add an entry in the list. When I select another layer the data will be added to the list. See image below.

                 list( "met1" "metal1" "drawing" "high" 1.0 2.0)

                list( "LMARK" "metal1" "drawing" "high" 1.0 2.0)
                list("george" "metal2" "drawing" "low" 3.0 1.0)
                list("harry" "metal3" "drawing" "low" -3.0 5.0)  

    *WARNING* hiDeleteField: field tabInfo3 is not in scroll region page1
    *WARNING* hiAddField: Cannot add non-unique field symbol to fieldList - tabInfo3

    I try to use the logic of after using the addField I will use the DeleteField to erase the old field but then I got some warning like the * above.

    Thanks for the help.

    -GP14

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to GP14

    It's not entirely clear what you're trying to do, but I suspect you just want to update the contents of the report field? If so, alternating the ->choices list would do it:

    choices=abExampleTabForm->tabField->page3->tabInfo3->choices
    abExampleTabForm->tabField->page3->tabInfo3->choices=cons(list("met1" "metal1" "drawing" "high" 1.0 2.0) choices)

    Andrew.

    • Cancel
    • Vote Up +1 Vote Down
    • Cancel
  • GP14
    GP14 over 6 years ago in reply to Andrew Beckett

    Hi Andrew,

    Basically you are right about what I meant in  this case.

    I try your suggested inputs in the code above but I did not get the right location where it will be place. I try to put it in the abAddField and change the error_lay_

    hilo into "choices" (this is the variable that you gave in your reply to our latest conversation) the next line that you gave I input it after hiCreateAppForm.

    Do I missed something about the code?

    For an instance I want my report field to be blank, then after I click add button it will be added to the report field then it gets updated after every add.

    Thanks for the help Andrew.

    Regards,

    GP14

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • GP14
    GP14 over 6 years ago in reply to GP14

    Its now done.

    Thanks!

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • GP14
    GP14 over 6 years ago in reply to GP14

    Its now done.

    Thanks!

    • 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