Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    ListGrid - context menu

    Hi,

    Two questions regarding context menus in ListGrids:

    - The showContextMenu() description in the Java API says:
    Show this menu as a context menu, that is, immediately adjacent to the current mouse position.
    Is there a way to show the menu at a given (x,y) position?
    I have a field with images in my ListGrid and would like to show the context menu just below those images when a click occurs.

    - Ideally, the images would have two states: normal and selected.
    I can update the image source and refresh the cell when the context menu is shown, but don't seem to be able to re-update the image when the menu is hidden (tried to override hideContextMenu(), but it is not called).
    Is there a good way to perform actions when a menu is hidden?

    Thanks,

    Dogan

    #2
    Use show() and moveTo() to position the menu (or any other widget) as you like.

    Menus normally dismiss when items are clicked on, so put your logic there - or are you trying to take some action when the menu is dismissed without any item being chosen? That seems odd..

    Comment


      #3
      Thanks for the answer.

      Regarding your comment, context menus also dismiss when a click occurs anywhere outside their area.
      Is there a way to catch this event?

      Comment


        #4
        What do you want to do with a click outside the context menu? It's starting to sound like your usage has less in common with a menu, and more in common with a modal dialog or similar, in which case you might want to start with Window instead.

        Comment


          #5
          Here is what I am trying to do:

          One of the columns in my ListGrid is a clickable image:



          When I click on an image, the context menu appears, and the image is changed:




          Then, when the context menu disappears (by either selecting an item or clicking away), I would like to reset the image to its initial state.

          Do you think that a Window is the way to go?

          Comment


            #6
            Did you decide how to go about this? I am trying to do the same thing. Thanks!

            Comment


              #7
              To get a menu (or any popup) to disappear with a click outside of it, I've been able to do it with a flag. So when the popup is selected set a flag (also set the position based on the event x and y) and then have a clickhandler on the mainlayout and inside that if the flag is set show the popup otherwise hide it (in your case hide and reset image). Of course your circumstance you might what the flag to be an index, so you can lookup the image.
              Last edited by svjard; 25 Feb 2010, 15:26.

              Comment

              Working...
              X