• 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. hiCreateTreeItem

Stats

  • Locked Locked
  • Replies 9
  • Subscribers 144
  • Views 16191
  • 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

hiCreateTreeItem

skillseeker
skillseeker over 12 years ago

 I am trying to figure out how to insert a dropdown list and also a subTree for a particular item on the tree.

Here is my sample code that i have taken from the forum website and changed it to map my names..

 

For TD_DIGITAL i want a subtree just like TD_CORE. How can i achieve this. If there are any alternatives not to use the Tree commands let me know as well. Thanks in advance.

 

;;----------------------------------------------------------------------------------------------

 indexTree=hiCreateTree('index)
; create two tree items and append them to the root tree
dow=hiCreateTreeItem('dow list("TD_CORE"))
hiTreeAppendItem(indexTree dow)
; create two sub-trees
dowTree=hiCreateTree('dows)
; put the two sub-trees into the two items created earlier
hiItemInsertTree(dow dowTree)
; add a few leaves for the dowTree and nasTree
hiTreeAppendItem(dowTree hiCreateTreeItem('cdn list("TD_DIGITAL" "XTD_DIGITAL" "verilog wreal veriloga schematic" "verilog")))
hiTreeAppendItem(dowTree hiCreateTreeItem('ibm list("VIO_SWITCH" "XVIO_SWITCH" "verilog wreal veriloga verilogams schematic" "wreal")))
hiTreeAppendItem(dowTree hiCreateTreeItem('rx list("RX" "XRX" "verilog wreal veriloga verilogams schematic" "schematic")))
hiTreeAppendItem(dowTree hiCreateTreeItem('ls list("TD_LS_CTRL" "XTD_LS_CTRL" "verilog wreal veriloga verilogams schematic" "schematic")))
hiTreeAppendItem(dowTree hiCreateTreeItem('bk list("BUCK" "XBUCK" "verilog wreal veriloga verilogams schematic" "veriloga")))
hiTreeAppendItem(dowTree hiCreateTreeItem('bo list("BOOST_3P0V" "XBOOST_3P0V" "verilog wreal veriloga verilogams schematic" "wreal")))

;hiTreeAppendItem(nasTree hiCreateTreeItem('orcl list("Oracle" 28.925 5 "Strong Sell")))
; create callback, which is called whenever any tree items are selected and which
; prints the selected item’s description
procedure( treeCB(name itemSymList)
   let(()
       while(itemSymList
            itemSym=car(itemSymList)
            println(hiGetTreeItemDescription(eval(itemSym)))
            itemSymList=cdr(itemSymList)
       )
   )
)



; create tree table and use indexTree as the value for ?choice
treeField = hiCreateTreeTable(
?name 'treeField
?title "TD_CORE"
?titleAlignment 'center
?headers list(list("CellName" 125 'left 'string)
list("instName" 125 'left 'string)
list("views" 250 'center 'string)
list("view" 125 'right 'string)
)
?choice indexTree
?callback "treeCB"
)
; create a form
form = hiCreateAppForm(
?name 'form
?formTitle "MakeFile Configurator"
?fields list(
list(treeField 5:5 900:450 55)
)
?initialSize 500:750)
hiDisplayForm(form)

 

 

 

 

 

Thanks

Devender

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

    Davender,

    I wasn't 100% sure what you wanted, but I modified your example above (probably wise to change the variable names, since they are not exactly meaningful). I've put in bold the bits I changed. I also changed the tree callback from treeCB to MYtreeCB as this clashes with a Cadence function which unfortunately has had the prefix omitted (I've filed a CCR to get that fixed).

    I also added a context menu - you mentioned a "dropdown list" - wasn't sure if that is what you wanted either.

    ;;----------------------------------------------------------------------------------------------

    ; example of adding a context menu
    hiCreateSimpleMenu('MYcontextMenu "Context Menu" list("Item 1" "Item 2") list("println('item1)" "println('item2)"))

     indexTree=hiCreateTree('index)
    ; create two tree items and append them to the root tree
    dow=hiCreateTreeItem('dow list("TD_CORE"))
    hiTreeAppendItem(indexTree dow)
    ; create two sub-trees
    dowTree=hiCreateTree('dows)
    ; put the two sub-trees into the two items created earlier
    hiItemInsertTree(dow dowTree)
    TdDigitalTree=hiCreateTree('TdDigitalTree)
    TdDigitalTreeItem=hiCreateTreeItem('TdDigitalTreeItem list("TD_DIGITAL"))
    hiItemInsertTree(TdDigitalTreeItem TdDigitalTree)
    hiTreeAppendItem(dowTree TdDigitalTreeItem)
    ; add a few leaves for the dowTree and nasTree
    hiTreeAppendItem(TdDigitalTree hiCreateTreeItem('cdn list("TD_DIGITAL" "XTD_DIGITAL" "verilog wreal veriloga schematic" "verilog")))

    hiTreeAppendItem(dowTree hiCreateTreeItem('ibm list("VIO_SWITCH" "XVIO_SWITCH" "verilog wreal veriloga verilogams schematic" "wreal")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('rx list("RX" "XRX" "verilog wreal veriloga verilogams schematic" "schematic")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('ls list("TD_LS_CTRL" "XTD_LS_CTRL" "verilog wreal veriloga verilogams schematic" "schematic")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('bk list("BUCK" "XBUCK" "verilog wreal veriloga verilogams schematic" "veriloga")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('bo list("BOOST_3P0V" "XBOOST_3P0V" "verilog wreal veriloga verilogams schematic" "wreal")))

    ;hiTreeAppendItem(nasTree hiCreateTreeItem('orcl list("Oracle" 28.925 5 "Strong Sell")))
    ; create callback, which is called whenever any tree items are selected and which
    ; prints the selected item¿s description
    procedure( MYtreeCB(name itemSymList)
       let(()
           while(itemSymList
                itemSym=car(itemSymList)
                println(hiGetTreeItemDescription(eval(itemSym)))
                itemSymList=cdr(itemSymList)
           )
       )
    )

    procedure(MYcontextMenuCB(menu form field item)
        printf("Context menu posted for item %L on form field %L\n" item field)
    )



    ; create tree table and use indexTree as the value for ?choice
    treeField = hiCreateTreeTable(
    ?name 'treeField
    ?title "TD_CORE"
    ?titleAlignment 'center
    ?headers list(list("CellName" 125 'left 'string)
    list("instName" 125 'left 'string)
    list("views" 250 'center 'string)
    list("view" 125 'right 'string)
    )
    ?choice indexTree
    ?callback "MYtreeCB"
    )
    ; create a form
    form = hiCreateAppForm(
    ?name 'form
    ?formTitle "MakeFile Configurator"
    ?fields list(
    list(treeField 5:5 900:450 55)
    )
    ?initialSize 500:750)

    form->treeField->hiContextMenu=MYcontextMenu
    form->treeField->hiShowContextMenuCallback='MYcontextMenuCB

    hiDisplayForm(form)

    Best Regards,

    Andrew

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

    Davender,

    I wasn't 100% sure what you wanted, but I modified your example above (probably wise to change the variable names, since they are not exactly meaningful). I've put in bold the bits I changed. I also changed the tree callback from treeCB to MYtreeCB as this clashes with a Cadence function which unfortunately has had the prefix omitted (I've filed a CCR to get that fixed).

    I also added a context menu - you mentioned a "dropdown list" - wasn't sure if that is what you wanted either.

    ;;----------------------------------------------------------------------------------------------

    ; example of adding a context menu
    hiCreateSimpleMenu('MYcontextMenu "Context Menu" list("Item 1" "Item 2") list("println('item1)" "println('item2)"))

     indexTree=hiCreateTree('index)
    ; create two tree items and append them to the root tree
    dow=hiCreateTreeItem('dow list("TD_CORE"))
    hiTreeAppendItem(indexTree dow)
    ; create two sub-trees
    dowTree=hiCreateTree('dows)
    ; put the two sub-trees into the two items created earlier
    hiItemInsertTree(dow dowTree)
    TdDigitalTree=hiCreateTree('TdDigitalTree)
    TdDigitalTreeItem=hiCreateTreeItem('TdDigitalTreeItem list("TD_DIGITAL"))
    hiItemInsertTree(TdDigitalTreeItem TdDigitalTree)
    hiTreeAppendItem(dowTree TdDigitalTreeItem)
    ; add a few leaves for the dowTree and nasTree
    hiTreeAppendItem(TdDigitalTree hiCreateTreeItem('cdn list("TD_DIGITAL" "XTD_DIGITAL" "verilog wreal veriloga schematic" "verilog")))

    hiTreeAppendItem(dowTree hiCreateTreeItem('ibm list("VIO_SWITCH" "XVIO_SWITCH" "verilog wreal veriloga verilogams schematic" "wreal")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('rx list("RX" "XRX" "verilog wreal veriloga verilogams schematic" "schematic")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('ls list("TD_LS_CTRL" "XTD_LS_CTRL" "verilog wreal veriloga verilogams schematic" "schematic")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('bk list("BUCK" "XBUCK" "verilog wreal veriloga verilogams schematic" "veriloga")))
    hiTreeAppendItem(dowTree hiCreateTreeItem('bo list("BOOST_3P0V" "XBOOST_3P0V" "verilog wreal veriloga verilogams schematic" "wreal")))

    ;hiTreeAppendItem(nasTree hiCreateTreeItem('orcl list("Oracle" 28.925 5 "Strong Sell")))
    ; create callback, which is called whenever any tree items are selected and which
    ; prints the selected item¿s description
    procedure( MYtreeCB(name itemSymList)
       let(()
           while(itemSymList
                itemSym=car(itemSymList)
                println(hiGetTreeItemDescription(eval(itemSym)))
                itemSymList=cdr(itemSymList)
           )
       )
    )

    procedure(MYcontextMenuCB(menu form field item)
        printf("Context menu posted for item %L on form field %L\n" item field)
    )



    ; create tree table and use indexTree as the value for ?choice
    treeField = hiCreateTreeTable(
    ?name 'treeField
    ?title "TD_CORE"
    ?titleAlignment 'center
    ?headers list(list("CellName" 125 'left 'string)
    list("instName" 125 'left 'string)
    list("views" 250 'center 'string)
    list("view" 125 'right 'string)
    )
    ?choice indexTree
    ?callback "MYtreeCB"
    )
    ; create a form
    form = hiCreateAppForm(
    ?name 'form
    ?formTitle "MakeFile Configurator"
    ?fields list(
    list(treeField 5:5 900:450 55)
    )
    ?initialSize 500:750)

    form->treeField->hiContextMenu=MYcontextMenu
    form->treeField->hiShowContextMenuCallback='MYcontextMenuCB

    hiDisplayForm(form)

    Best Regards,

    Andrew

    • 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