Announcement

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

    Showing Menu on top of StripItem does not work first time

    Please consider the following example:
    Code:
    public void onModuleLoad(){
        Menu menu = new Menu();
        menu.addItem(new MenuItem("Use"));
        menu.addItem(new MenuItem("The"));
        menu.addItem(new MenuItem("Fork"));
        menu.addItem(new MenuItem("Lucy"));
    
        ToolStrip strip = new ToolStrip();
        strip.setWidth100();
        ToolStripButton button = new ToolStripButton("Show");
        strip.addButton(button);
    
        button.addClickHandler(clickEvent ->menu.showNextTo(button, "top"));
    
        Layout main = new VLayout();
        main.setAlign(VerticalAlignment.CENTER);
        main.setWidth100().setHeight100();
        main.addMember(strip);
        main.draw();
    }
    When the toolstripbutton is clicked on the first time, the menu does not appear on top of it, as i would have expected, but rather above it, occluding it. If i hide it and then click the button again, it works as expected.

    Seems like a bug? Is there a workaround? Thanks in advance, screenshots to save you time below:

    Initial:
    Click image for larger version

Name:	Screenshot 2022-08-29 at 13.14.41.png
Views:	168
Size:	1.5 KB
ID:	268562
    First click:
    Click image for larger version

Name:	Screenshot 2022-08-29 at 13.14.48.png
Views:	150
Size:	5.6 KB
ID:	268563
    Second click:
    Click image for larger version

Name:	Screenshot 2022-08-29 at 13.14.55.png
Views:	151
Size:	6.6 KB
ID:	268564

    #2
    Thanks for the report - this was a draw-timing issue and has been addressed for builds dated August 31 and later.

    You can likely work around it in your current version by just drawing the menu to compute its size, before positioning it.

    Comment

    Working...
    X