• 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 select all items for a sub tree when I click its...

Stats

  • Locked Locked
  • Replies 2
  • Subscribers 143
  • Views 13898
  • 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 select all items for a sub tree when I click its parent item?

iDave
iDave over 6 years ago

Hi all

The following is the test code. 

root=hiCreateTree(‘root)

item1=hiCreateTreeItem(‘item1 list(“count”))

item2=hiCreateTreeItem(‘item2 list(“name”))

hiTreeAppendItems(root list(item1 item2))

tree1=hiCreateTree(‘tree1)

tree2=hiCreateTree(‘tree2)

hiItemInsertTree(item1 tree1)

hiItemInsertTree(item2 tree2)

for(i 1 1000

    count=concat(“num” i)

    hiTreeAppendItem(tree1 hiCreateTreeItem(count list(artMakeString(i))))

    name=concat(“name” i)

    hiTreeAppendItem(tree2 hiCreateTreeItem(name list(artMakeString(i))))

)

treeFiled=hiCreateTreeTable(

    ?name ‘treeField

    ?headers list(list(“info” 50 ‘center ‘string t))

    ?choice root

)

form=hiCreateAppForm(

    ?name ‘form

    ?fields list(list(treeField 5:5 300:300 0))

)

hiDisplayForm(form)

After the form pop-up, I click the item “name” , how to make all sub items for “name” selected?

Any help will be appreciated.

Dave

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

    Dave,

    This does it. Not sure it's a good idea though (it's rather slow - the slowness is when using hiTreeTableSelectItems with lots of items - if this is a problem in your real application, please contact customer support).

    root=hiCreateTree('root)
    item1=hiCreateTreeItem('item1 list("count"))
    item2=hiCreateTreeItem('item2 list("name"))
    hiTreeAppendItems(root list(item1 item2))
    tree1=hiCreateTree('tree1)
    tree2=hiCreateTree('tree2)
    hiItemInsertTree(item1 tree1)
    hiItemInsertTree(item2 tree2)
    for(i 1 1000
        count=concat("num" i)
        hiTreeAppendItem(tree1 hiCreateTreeItem(count list(artMakeString(i))))
        name=concat("name" i)
        hiTreeAppendItem(tree2 hiCreateTreeItem(name list(artMakeString(i))))
    )
    treeField=hiCreateTreeTable(
        ?name 'treeField
        ?headers list(list("info" 50 'center 'string t))
        ?choice root
        ;?callback "CCFselectTreeMembers(hiGetCurrentForm()->treeField)"
        ?callback "CCFselectTreeMembers"
    )
    form=hiCreateAppForm(
        ?name 'form
        ?fields list(list(treeField 5:5 300:300 0))
    )
    
    procedure(CCFselectTreeMembers(fieldName selection)
        let((tree newSelection field)
    	field=get(hiGetCurrentForm() fieldName)
    	newSelection=copy(selection)
    	foreach(item selection
    	    tree=hiGetTree(symeval(item))
    	    when(tree
    		newSelection=append(newSelection hiGetTreeItems(symeval(tree)))
    	    )
    	)
    	; select items but don't trigger callback again
    	hiTreeTableSelectItems(field newSelection nil)
        )
    )
    
    hiDisplayForm(form)

    Andrew

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

    Dave,

    This does it. Not sure it's a good idea though (it's rather slow - the slowness is when using hiTreeTableSelectItems with lots of items - if this is a problem in your real application, please contact customer support).

    root=hiCreateTree('root)
    item1=hiCreateTreeItem('item1 list("count"))
    item2=hiCreateTreeItem('item2 list("name"))
    hiTreeAppendItems(root list(item1 item2))
    tree1=hiCreateTree('tree1)
    tree2=hiCreateTree('tree2)
    hiItemInsertTree(item1 tree1)
    hiItemInsertTree(item2 tree2)
    for(i 1 1000
        count=concat("num" i)
        hiTreeAppendItem(tree1 hiCreateTreeItem(count list(artMakeString(i))))
        name=concat("name" i)
        hiTreeAppendItem(tree2 hiCreateTreeItem(name list(artMakeString(i))))
    )
    treeField=hiCreateTreeTable(
        ?name 'treeField
        ?headers list(list("info" 50 'center 'string t))
        ?choice root
        ;?callback "CCFselectTreeMembers(hiGetCurrentForm()->treeField)"
        ?callback "CCFselectTreeMembers"
    )
    form=hiCreateAppForm(
        ?name 'form
        ?fields list(list(treeField 5:5 300:300 0))
    )
    
    procedure(CCFselectTreeMembers(fieldName selection)
        let((tree newSelection field)
    	field=get(hiGetCurrentForm() fieldName)
    	newSelection=copy(selection)
    	foreach(item selection
    	    tree=hiGetTree(symeval(item))
    	    when(tree
    		newSelection=append(newSelection hiGetTreeItems(symeval(tree)))
    	    )
    	)
    	; select items but don't trigger callback again
    	hiTreeTableSelectItems(field newSelection nil)
        )
    )
    
    hiDisplayForm(form)

    Andrew

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

    Hi Andrew,

    This is what I want. 

    thank you.

    • 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