• 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. Context Menu For Tree Table

Stats

  • Locked Locked
  • Replies 7
  • Subscribers 145
  • Views 15527
  • 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

Context Menu For Tree Table

sarionaissi
sarionaissi over 12 years ago

I created a context menu for a tree table. It works fine when I chose items in the table and right-click. However, if the table is empty or if no items are chosen, the context menu does not appear when I right-click over the table.

 Does anyone know why this might be happening?

  • Cancel
Parents
  • sarionaissi
    sarionaissi over 12 years ago

    Here is a self-contained example with two procedures. The first one creates a tree table with two items in it and an associated context menu. The second procedure "TestCreateMyTreeTable()" calls the first to create a tree table and then creates a form and displays it. You will see that if you choose any of the items and right-click then the context menu will come up. However if you right-click anywhere on the table without choosing an item then the context menu won't show up. I'm not sure why this is happening.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;procedure that creates the tree table
    procedure( CreateMyTreeTable(dimensions)
      let( (table_headers)

        table_headers = list(list("C1" 200 'center) list("C2" 200 'center)
                                                            list("C3" 200 'center))
        ;;create the tree
        my_tree = hiCreateTree('my_tree)
       
        ;;get the handle of the field
        my_tree_table = hiCreateTreeTable(
          ?name 'my_tree_table
          ?title ""
          ?choice my_tree
          ?headers table_headers
          ?titleAlignment 'left
        )
      
        item_1 = hiCreateTreeItem('item_1 list("E1" "E2" "E3"))
        item_2 = hiCreateTreeItem('item_2 list("F1" "F2" "F3"))
        hiTreeAppendItem(my_tree item_1)
        hiTreeAppendItem(my_tree item_2)
       
        ;;context menu item
        context_item = hiCreateMenuItem(?name 'context_item
                                        ?itemText "An Item"
                                        ?callback "printf(\"hello\n\")")

        context_menu = hiCreateMenu('context_menu "" list(context_item))
       
        my_tree_table->hiContextMenu = context_menu  

        my_tree_table
      );let
    );procedure

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; Tests

    procedure( TestCreateMyTreeTable()
      let( (origin dimensions prompt_height test_field test_field_2D
                                                                   form_dimensions)
       
        ;;create the tree table 
        origin = 10:70
        dimensions = 500:500
        prompt_height = 20
        test_field = CreateMyTreeTable(dimensions)
        test_field_2D = list(test_field origin dimensions prompt_height)  

        ;;create the form
        form_dimensions = 600:600
        ;create a dummy field the form
        tree_test_form = hiCreateAppForm(
                          ?name 'tree_test_form
                          ?formTitle "test form"
                          ?callback "printf(\"Test Done!\n\")"
                          ?fields list(test_field_2D)
                          ?dontBlock t
                          ?initialSize form_dimensions
                          ?help nil )

        hiDisplayForm(tree_test_form)
        tree_test_form
      );let
    );procedure
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


     

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • sarionaissi
    sarionaissi over 12 years ago

    Here is a self-contained example with two procedures. The first one creates a tree table with two items in it and an associated context menu. The second procedure "TestCreateMyTreeTable()" calls the first to create a tree table and then creates a form and displays it. You will see that if you choose any of the items and right-click then the context menu will come up. However if you right-click anywhere on the table without choosing an item then the context menu won't show up. I'm not sure why this is happening.

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;;procedure that creates the tree table
    procedure( CreateMyTreeTable(dimensions)
      let( (table_headers)

        table_headers = list(list("C1" 200 'center) list("C2" 200 'center)
                                                            list("C3" 200 'center))
        ;;create the tree
        my_tree = hiCreateTree('my_tree)
       
        ;;get the handle of the field
        my_tree_table = hiCreateTreeTable(
          ?name 'my_tree_table
          ?title ""
          ?choice my_tree
          ?headers table_headers
          ?titleAlignment 'left
        )
      
        item_1 = hiCreateTreeItem('item_1 list("E1" "E2" "E3"))
        item_2 = hiCreateTreeItem('item_2 list("F1" "F2" "F3"))
        hiTreeAppendItem(my_tree item_1)
        hiTreeAppendItem(my_tree item_2)
       
        ;;context menu item
        context_item = hiCreateMenuItem(?name 'context_item
                                        ?itemText "An Item"
                                        ?callback "printf(\"hello\n\")")

        context_menu = hiCreateMenu('context_menu "" list(context_item))
       
        my_tree_table->hiContextMenu = context_menu  

        my_tree_table
      );let
    );procedure

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    ;; Tests

    procedure( TestCreateMyTreeTable()
      let( (origin dimensions prompt_height test_field test_field_2D
                                                                   form_dimensions)
       
        ;;create the tree table 
        origin = 10:70
        dimensions = 500:500
        prompt_height = 20
        test_field = CreateMyTreeTable(dimensions)
        test_field_2D = list(test_field origin dimensions prompt_height)  

        ;;create the form
        form_dimensions = 600:600
        ;create a dummy field the form
        tree_test_form = hiCreateAppForm(
                          ?name 'tree_test_form
                          ?formTitle "test form"
                          ?callback "printf(\"Test Done!\n\")"
                          ?fields list(test_field_2D)
                          ?dontBlock t
                          ?initialSize form_dimensions
                          ?help nil )

        hiDisplayForm(tree_test_form)
        tree_test_form
      );let
    );procedure
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


     

    • 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