Home > Community > Forums > Custom IC SKILL > Context Menu For Tree Table

Email

* Required Fields

Recipients email * (separate multiple addresses with commas)

Your name *

Your email *

Message *

Contact Us

* Required Fields
First Name *

Last Name *

Email *

Company / Institution *

Comments: *

 Context Menu For Tree Table 

Last post Thu, Jan 31 2013 5:39 AM by dmay. 7 replies.
Started by sarionaissi 24 Jan 2013 12:29 PM. Topic has 7 replies and 1230 views
Page 1 of 1 (8 items)
Sort Posts:
  • Thu, Jan 24 2013 12:29 PM

    Context Menu For Tree Table Reply

    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?

    • Post Points: 20
  • Thu, Jan 24 2013 3:39 PM

    • marcelpreda
    • Top 200 Contributor
    • Joined on Tue, Jan 19 2010
    • Bucharest, Romania
    • Posts 44
    • Points 715
    Re: Context Menu For Tree Table Reply

    Some code to show ?!

     

    BR,

    Marcel

    • Post Points: 20
  • Thu, Jan 24 2013 4:17 PM

    Re: Context Menu For Tree Table Reply

    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
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


     

    • Post Points: 20
  • Wed, Jan 30 2013 3:17 AM

    • marcelpreda
    • Top 200 Contributor
    • Joined on Tue, Jan 19 2010
    • Bucharest, Romania
    • Posts 44
    • Points 715
    Re: Context Menu For Tree Table Reply

    Hi there,

    I looks OK to me.

    If there is no item selected why whould like to have a menu popped up on the rigth click?

     

    BR,

    Marcel

     

    • Post Points: 20
  • Wed, Jan 30 2013 7:03 AM

    Re: Context Menu For Tree Table Reply

     For me, if I don't left click to select before doing Right->Context menu, it selects the item I'm over and posts the menu. This is in IC615 ISR15. If you're not over anything, I wouldn't expect it  to post the context menu (i.e. there's no context).

    So I'm not really sure what the problem you're describing is either.

    Regards,

    Andrew.

    • Post Points: 20
  • Wed, Jan 30 2013 9:42 AM

    Re: Context Menu For Tree Table Reply

    Hello all and thanks for your replies.

    The reason I would like to have this functionality is that I want to use the context menu to populate the table. For example, I want to use it to launch another form that the user can use to add items to the table. 

    • Post Points: 35
  • Wed, Jan 30 2013 11:07 PM

    Re: Context Menu For Tree Table Reply

    I think that would require an enhancement, so best to contact customer support about this.

    Regards,

    Andrew.

    • Post Points: 5
  • Thu, Jan 31 2013 5:39 AM

    • dmay
    • Top 25 Contributor
    • Joined on Thu, Jul 17 2008
    • Allen, TX
    • Posts 394
    • Points 7,420
    Re: Context Menu For Tree Table Reply

    Why don't you simply add a button to another part of your form for "adding" new items to the table?

    Derek

    • Post Points: 5
Page 1 of 1 (8 items)
Sort Posts:
Started by sarionaissi at 24 Jan 2013 12:29 PM. Topic has 7 replies.