Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
835
WebExplorerBar Mouse Events
posted

I want to capture the MouseClick event in Java script on some ExplorerBarItems and bring up a context menu, but the ExplorerBar object does not expose this event.  I capture the Click event, but I don't see any info in the ExplorerBarCancelEventArgs that gives me the mouse information.  In looking at the eventArgs.getExplorerBarItem()._node._element.onmousedown, it looks like I should be able to capture it, but I don't know how to connect to that.

Basically, I am trying to capture information that used to be available on the 'Classic' ultrawebtree NodeClick event, but am being challenged in making it work on the new controls.

My items are all dynamically loaded via vb.net (2012) code, with each Group containing distinct information.  I used to do this by having each group have it's own UserControl, but with the new controls I have lost that capability!  I now add the WebExplorerItems to each dynamically created Group item, and would prefer to add the appropriate listener at that time. 

I am using 2013.1 tools with .Net 4.5.

Thanks!

...Steve

Parents
No Data
Reply
  • 9190
    Offline posted

    Hello Steve,

    I will be happy to assist you with your question.

    You should be able to retrieve the mouse coordinates using the Window object as demonstrated in the code snippet below: 

    Code Snippet
    1. <html xmlns="http://www.w3.org/1999/xhtml">
    2. <head runat="server">
    3.     <title></title>
    4.     <script type="text/javascript" id="igClientScript">
    5. <!--
    6.  
    7. function WebExplorerBar1_ItemClick(sender, eventArgs)
    8. {
    9.     ///<summary>
    10.     ///
    11.     ///</summary>
    12.     ///<param name="sender" type="Infragistics.Web.UI.WebExplorerBar"></param>
    13.     ///<param name="eventArgs" type="Infragistics.Web.UI.ExplorerBarCancelEventArgs"></param>
    14.  
    15.     var item = eventArgs.getExplorerBarItem();
    16.  
    17.     if (item != null) {
    18.         var s = 'X=' + window.event.clientX + ' Y=' + window.event.clientY;
    19.         var itemText = item.get_text();
    20.  
    21.         document.getElementById('divCoord').innerText = itemText + " has been clicked at position " + s;
    22.     }
    23. }// -->
    24. </script>
    25. </head>
    26. <body onmousedown="WebExplorerBar1_ItemClick()">
    27.     <form id="form1" runat="server">
    28.         <div id="divCoord"></div>
    29.         <ig:WebExplorerBar ID="WebExplorerBar1" runat="server" Width="683px" GroupContentsHeight="" Height="459px">
    30.             <ClientEvents ItemClick="WebExplorerBar1_ItemClick" />
    31.             <Groups>
    32.                 <ig:ExplorerBarGroup GroupContentsHeight="" Text="Group">
    33.                     <Items>
    34.                         <ig:ExplorerBarItem Text="Item">
    35.                         </ig:ExplorerBarItem>
    36.                     </Items>
    37.                 </ig:ExplorerBarGroup>
    38.             </Groups>
    39.         </ig:WebExplorerBar>
    40.         <ig:WebScriptManager ID="WebScriptManager1" runat="server">
    41.         </ig:WebScriptManager>
    42.     </form>
    43. </body>
    44. </html>

     

    Please review the code snippet and let me know if you have any questions regarding my suggestion.

Children