Auto-focus ListChooser search field on desktop

Increase width of buttons on DualListBox
Make border on ListChooser show up on certain themes
This commit is contained in:
drdev
2014-05-03 15:36:56 +00:00
parent 1c9edb4380
commit bddfff41f2
3 changed files with 13 additions and 4 deletions

View File

@@ -151,7 +151,7 @@ public class DualListBox<T> extends FDialog {
float buttonHeight = FOptionPane.BUTTON_HEIGHT;
float labelHeight = selectOrder.getAutoSizeBounds().height;
float listHeight = (maxHeight - 2 * labelHeight - buttonHeight - FOptionPane.PADDING - 2 * FDialog.INSETS) / 2;
float addButtonWidth = addAllButton.getAutoSizeBounds().width;
float addButtonWidth = addAllButton.getAutoSizeBounds().width * 1.2f;
float addButtonHeight = listHeight / 2 - gapBetweenButtons;
float listWidth = width - addButtonWidth - gapBetweenButtons;

View File

@@ -145,7 +145,12 @@ public class FTextField extends FDisplayObject {
@Override
public boolean tap(float x, float y, int count) {
if (keyInputActive) { return true; } //do nothing if key input already active
startEdit();
return true;
}
public void startEdit() {
if (keyInputActive) { return; } //do nothing if key input already active
selStart = 0; //select all before starting input
selLength = text.length();
@@ -224,7 +229,6 @@ public class FTextField extends FDisplayObject {
}
});
keyInputActive = true;
return true;
}
@Override

View File

@@ -18,6 +18,8 @@
package forge.toolbox;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Application.ApplicationType;
import com.badlogic.gdx.graphics.g2d.BitmapFont.HAlignment;
import com.google.common.base.Function;
@@ -65,7 +67,7 @@ public class ListChooser<T> extends FContainer {
public static final FSkinColor ITEM_COLOR = FSkinColor.get(Colors.CLR_ZEBRA);
public static final FSkinColor ALT_ITEM_COLOR = ITEM_COLOR.getContrastColor(-20);
public static final FSkinColor SEL_COLOR = FSkinColor.get(Colors.CLR_ACTIVE);
public static final FSkinColor BORDER_COLOR = FSkinColor.get(Colors.CLR_BORDERS);
public static final FSkinColor BORDER_COLOR = FList.FORE_COLOR;
public static final float ITEM_HEIGHT = Utils.AVG_FINGER_HEIGHT * 0.75f;
// Data and number of choices for the list
@@ -181,6 +183,9 @@ public class ListChooser<T> extends FContainer {
}
onSelectionChange();
optionPane.show();
if (txtSearch != null && Gdx.app.getType() == ApplicationType.Desktop) {
txtSearch.startEdit(); //automatically focus search textbox for edit if on desktop
}
}
private void onSelectionChange() {