0

我有一组使用PopupView. 自 Charm 4.0.0 更新以来,它们表现出一些奇怪的行为。

当我选择一个Node包含在 PopupView 中时,PopupView 用来关闭。现在 PopupView 被关闭但立即再次出现。此外,一旦我在 PopupView 外部单击它就会关闭,但我无法再次显示它。

我已经使用Gluon javadoc中的示例对其进行了测试,并在第二个问题上遇到了相同的行为:

 public class MyApp extends MobileApplication{
   private Button button;
   private PopupView popupView;

   @Override
   public void init() {
       addViewFactory(HOME_VIEW, ()  -> {
       button = new Button("Click");
       button.setOnAction(event  -> popupView.show());

       popupView = new PopupView(button);

       VBox vBox = new VBox();
       vBox.getChildren().addAll(new Label("Choice 1"), new Label("Choice 2"), new Label("Choice 3"));
       vBox.setSpacing(5);

       popupView.setContent(vBox);

       return new View(button) {
         @Override
         protected void updateAppBar(AppBar appBar) {
           appBar.setTitleText("PopupView");
         }
       };
     });
   }
 } 
4

1 回答 1

0

感谢您的报告。我已经提交了一个问题,所以它会尽快得到修复。

同时,PopupView 的解决方法可以是:

PopupView popupView = new PopupView(button) {

    private final GlassPane glassPane = MobileApplication.getInstance().getGlassPane();

        {
            this.setOnMouseReleased(e -> this.hide());
        }

    @Override public void show() {
        // before showing add the glassPane (issue #2):
        this.mobileLayoutPaneProperty().set(glassPane);
        super.show(); 
    }

    @Override public void hide() {
        // when hiding don't show again (issue #1):
        setShowing(false);
        super.hide(); 
    }
};
于 2016-11-01T09:17:58.130 回答