Charm 4.0.0 PopupView 只显示一次
Charm 4.0.0 PopupView shows up only once
我有一组使用 PopupView
的控件。
自从更新到 Charm 4.0.0 后,它们表现出一些奇怪的行为。
当我选择包含在 PopupView 中的 Node
时,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");
}
};
});
}
}
感谢您的报告。我已提交问题,以便尽快解决。
与此同时,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();
}
};
我有一组使用 PopupView
的控件。
自从更新到 Charm 4.0.0 后,它们表现出一些奇怪的行为。
当我选择包含在 PopupView 中的 Node
时,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");
}
};
});
}
}
感谢您的报告。我已提交问题,以便尽快解决。
与此同时,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();
}
};