Menu

Popup menu

Help
mondai_nai
2008-07-14
2013-04-29
  • mondai_nai

    mondai_nai - 2008-07-14

    Hi! This project is awesome. I wonder if there is a neat way of adding a popup-menu (like setComponentPopupMenu) to a BrowserPanel?

    Thanks for your all your work!

     
    • Trejkaz

      Trejkaz - 2008-07-16

      Have you tried overriding onContextMenu on the HtmlRendererContext?  That lets you do per-element context as well, but presumably you could just hard-code it to show the same one for anywhere.

       
      • mondai_nai

        mondai_nai - 2008-09-24

        Hello again.

        This problem is really driving me nuts. What I want to do is to detect right-clicks so that I can display a popup menu. I'm using BrowserPanel, and no matter what hacks I've tried I can't get ahold of whatever component is displayed in the panel.

        I have no idea of how to access HtmlRendererContext, or how to inject it into a BrowserPanel. I would really like that, because it might solve other problems I have too.

         
    • Lobo Project Lead

      BrowserPanel doesn't provide that capability right now. HtmlRendererContext is in Cobra, not  Lobo.

      I assume you've tried adding a MouseListener to BrowserPanel and that didn't work?

      I'm not sure how to solve it, other than changing the source code. Context menues are of course a must-have to complete the browser.

       
      • mondai_nai

        mondai_nai - 2008-09-25

        Hi,

        I've read the source code, and through a hack that makes me blush I've managed to add a mouse listener to the browser.

        One problem is that whenever new content is rendered, a new component is created and put in the BrowserPanel.

        I don't know how to post code in this forum, but this is how I did it:

        1. Added a NavigatorListener to my BrowserPanel and implemented documentRendering(evt).

        2. From the event I got a reference to the NavigatorFrame

        3. From the NavigatorFrame I got ahold of its ComponentContent

        4. From the ComponentContent I got a component (an HtmlPanel)

        5. Added a mouse listener to the (only) child component of the HtmlPanel.

        6. Stored a weak reference to the child component, so that I could...

        0. Remove the mouse listener from the previous component.

        Should I add a request for context menues? I feel really bad for wishing things in a project that I don't contribute to, but I don't have time to spare.

         
    • Lobo Project Lead

      Sure, go ahead and add a feature request for it. That not only serves as a reminder, but you can also monitor it and get notified of progress.

       

Log in to post a comment.