> On 24 June 2011 17:08, Edvin Syse <[email protected]> wrote: > > Perhaps org.apache.pivot.wtk.MenuHandler needs a new configureMenuButton() > method equivalent to configureContextMenu()? > A MenuHandler property could then be added to MenuButton. > > I think that would be a good idea. With my current approach I sometimes end > up with a menu that is rendered partly outside of the Window. Can I somehow > reposition it? > > I haven't tried, but I imagine that some combination of invalidate/repaint > calls on the pop up window should do it. > Perhaps invalidate the window and repaint in the windowOpened listener, after > you have configured the menu?
At first, I thought the idea of listening for the open event was OK, but after looking at the code I'm not sure that it is. TerraMenuButtonSkin also listens for the open event and repositions the popup when it is fired. Since the skin will probably get the event before your code, it is attempting to position an empty window. To fix this, it would need to queue a callback to position the window. That could result in flicker as the window is resized/repositioned. We actually used to have an open preview event in addition to close preview. An open preview event would solve this problem, since you could populate your menu in response to that event. G
