Reputation: 6249
This question is referring to Codename One only.
I need to show the same instance of a Form multiple times. I need that the swipe of the Tabs is disabled on the first show (and on the second, the third, etc.), but on the last show the swipe should be enabled.
This situation is like the following test case:
Form hi = new Form("Hi World", BoxLayout.y());
Tabs tabs = new Tabs();
tabs.addTab("Tab1", new Label("Tab1"));
tabs.addTab("Tab2", new Label("Tab2"));
tabs.addTab("Tab3", new Label("Tab3"));
hi.add(tabs);
tabs.setSwipeActivated(false);
hi.show();
hi.addShowListener(l -> {
UITimer.timer(1000, false, hi, () -> {
hi.show();
tabs.setSwipeActivated(true);
});
});
I inserted the UITimer only to remember that the same instance of the Form is not shown multiple times immediately, but there is a time that depends by the user interaction.
The problem is that a code like this test case doesn't work, because at the end the swipe of Tabs is disabled. I tested several workarounds, but none of them is satisfying.
Upvotes: 1
Views: 29
Reputation: 52770
There was an assumption that this won't change dynamically so listeners weren't registered correctly. I wrote a fix for this and committed it. It should be up tomorrow: https://github.com/codenameone/CodenameOne/commit/e2c7f50d97dd37633ac4e946fe41e6db85d3412d
Upvotes: 1