X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTComboBox.java;h=b64dbde058ad006d4a5d80fd83e9ddd4303e8ba2;hb=7ed28054941adbb9e7f2b4487fa9d2325b12a752;hp=fe2fdacf7a794e5620fad37fabeeec49097196c9;hpb=8ab60a33f89f656b71751a45967c79179415f652;p=fanfix.git diff --git a/src/jexer/TComboBox.java b/src/jexer/TComboBox.java index fe2fdac..b64dbde 100644 --- a/src/jexer/TComboBox.java +++ b/src/jexer/TComboBox.java @@ -114,12 +114,12 @@ public class TComboBox extends TWidget { field.setText(list.getSelected()); list.setEnabled(false); list.setVisible(false); - TComboBox.this.setHeight(1); + TComboBox.super.setHeight(1); if (TComboBox.this.limitToListValue == false) { TComboBox.this.activate(field); } if (updateAction != null) { - updateAction.DO(); + updateAction.DO(TComboBox.this); } } } @@ -130,7 +130,7 @@ public class TComboBox extends TWidget { list.setEnabled(false); list.setVisible(false); - setHeight(1); + super.setHeight(1); if (limitToListValue) { field.setEnabled(false); } else { @@ -215,6 +215,33 @@ public class TComboBox extends TWidget { // TWidget ---------------------------------------------------------------- // ------------------------------------------------------------------------ + /** + * Override TWidget's width: we need to set child widget widths. + * + * @param width new widget width + */ + @Override + public void setWidth(final int width) { + if (field != null) { + field.setWidth(width - 3); + } + if (list != null) { + list.setWidth(width); + } + super.setWidth(width); + } + + /** + * Override TWidget's height: we can only set height at construction + * time. + * + * @param height new widget height (ignored) + */ + @Override + public void setHeight(final int height) { + // Do nothing + } + /** * Draw the combobox down arrow. */ @@ -253,7 +280,7 @@ public class TComboBox extends TWidget { public void hideList() { list.setEnabled(false); list.setVisible(false); - setHeight(1); + super.setHeight(1); if (limitToListValue == false) { activate(field); } @@ -265,7 +292,7 @@ public class TComboBox extends TWidget { public void showList() { list.setEnabled(true); list.setVisible(true); - setHeight(list.getHeight() + 1); + super.setHeight(list.getHeight() + 1); activate(list); }