This is a migrated thread and some comments may be shown as answers.

Hiding Context Menu

2 Answers 94 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Som
Top achievements
Rank 1
Som asked on 12 Feb 2008, 03:44 PM
1. The context menu stays open when I use the arrow keys to navigate the tree. How can I close the context menu once the user is no longer on the node that they opened the menu for.

2.  In the Rad controls for ASP.NET the "Enter Key" worked to expand/contact a node, but it does not work the same way in Prometheus. Did you change this design or am I missing something.

3. Can I use the escape key to close the context menu?

Thanks for the help.

Som

2 Answers, 1 is accepted

Sort by
0
Nikolay
Telerik team
answered on 14 Feb 2008, 03:35 PM
Hello Som,

Actually, this behavior is not the actual behavior of the current RadTreeView Prometheus edition. However, you can easily accomplish the task using the keyDown event of the treeview. Since there was no OnClientKeyPressing property of the treeview, we included it in the very latest build so that you can simply set the OnClientKeyPressing property to the name of the event handler instead of manually attaching the event.

In the event handler, you can check which key has been clicked and perform the needed action:

<script>         
         
        function OnClientKeyPressing(sender, args)             
            {                    
                var node = args.get_node(); 
                var key = args.get_domEvent().keyCode; 
                if((key>=37)&&(key<=40) || (key==27)) 
                { 
                    var menu = $find(node.get_resolvedContextMenuID()); 
                    menu.hide(); 
                } 
                 
                if(key == "13"
                    node.toggle(); 
            }                
         
    </script> 

I attached a small and running project for your reference. Please download the files and give them a go.

I hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Vishal
Top achievements
Rank 1
answered on 24 Jul 2008, 06:15 AM
Hi,

I have an issue with radcontextmenu.

I am creating controls dynamically on  my web page. I want to attach the context menu with that controls. I am able to do that but my issue is :

I want to populate the context menu on the press of 'F10' function key for the selected control on the page i.e. if there is a textbox on my page and i selects that textbox and now i presses the F10 the context menu should populate for that control.

It will be great if you can provide any example for this.
Tags
TreeView
Asked by
Som
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Vishal
Top achievements
Rank 1
Share this question
or