私の問題は次のとおりです。私はいくつかのタブを含むフォームを持っています。最初のものでは、私は情報を含むテーブルを持っています。私の問題は、新しいフォームを開いて(Dialogと言う)、それを閉じると、私のテーブルレイアウトが予期せず変更されてしまうことです。私は新しいフォームを開いて、戻るボタンを使用して同じ動作が観察されます。コード名1 - 別のフォームから戻ったときにTableLayoutが変更されるのはなぜですか?
私は問題を示しているだけで一つのタブ、で、ここでは以下の最小限の例を設定している:特に
public class spmonMobileApp {
private Form current;
private Resources theme;
private Table table;
public void init(Object context) {
theme = UIManager.initFirstTheme("/theme");
// Enable Toolbar on all Forms by default
Toolbar.setGlobalToolbar(true);
}
public void start() {
Form tabsForm = new Form("", new LayeredLayout());
Tabs tabs = new Tabs(Component.BOTTOM);
Container mainContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
TableModel tableModel = new DefaultTableModel(new String[] {""}, new Object[][] {{"MCR"}, {"SSR"}, {"HQ"}}, false);
table = new Table(tableModel) {
@Override
protected Component createCell(Object value, int row, int column, boolean editable) { // (1)
Component p = new Label((String)value);
p.getAllStyles().setBgColor(0xFFFF00);
p.getAllStyles().setBgTransparency(255);
p.getAllStyles().setAlignment(CENTER);
p.addPointerPressedListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent evt) {
//createDataForm((String)value).show();
System.out.println(((TableLayout)table.getLayout()).isGrowHorizontally());
Dialog.show("Example", "Just a test", "OK", "Cancel");
System.out.println(((TableLayout)table.getLayout()).isGrowHorizontally());
}
});
return p;
}
};
((TableLayout)table.getLayout()).setGrowHorizontally(true);
mainContainer.add(table);
tabs.addTab("Welcome", mainContainer);
tabsForm.add(tabs);
tabsForm.show();
}
public void stop() {
current = Display.getInstance().getCurrent();
if(current instanceof Dialog) {
((Dialog)current).dispose();
current = Display.getInstance().getCurrent();
}
}
public void destroy() {
}
}
、isGrowHorizontally()は、ダイアログを開く前に真であることがわかると、その後はfalseになります(ラベルは縮小されます)。
視覚的な結果は、(右のそれを閉じた後で、左のダイアログ(望ましい行動を開く前にある))は、次の画像で見ることができます。
ので、それがない理由を誰もが知っていますそれ?もしそうなら、誰でも問題を解決する方法を知っていますか(または私がひどく間違っているのは:-))?
もしそうでなければ、セルを画面の幅全体に広げ、ダイアログを閉じた後でもそのようにする方法を知っている人はいますか?
ありがとうございます!
デネブ
非常によく書かれた最初の質問です。ようこそ! – MordechayS
ありがとう!私はアイデアが個人的に不足しているので、誰かが解決策を持っていることを願っています。 -/ – Deneb