[SOLVED] Cannot listen for tab?

So I found an interesting issue that I am not fully understanding and am hoping that someone can help clear up. I have a StateFunctionListener listeneing for a keypress, and it works with the F key, but not with TAB. I have no idea why, and am hoping that someone knows. This is the Listener:

import com.jme3.input.KeyInput;
import com.simsilica.lemur.GuiGlobals;
import com.simsilica.lemur.input.FunctionId;
import com.simsilica.lemur.input.InputMapper;
import com.simsilica.lemur.input.InputState;
import com.simsilica.lemur.input.StateFunctionListener;

 * Enable or disable the cursor with tab key
public class GuiCursorControlListener implements StateFunctionListener {

    private final String GUI_TAB = "Cursor Tabber";
    private final FunctionId F_TAB = new FunctionId(GUI_TAB, "Cursor Tab Function");

    //private final ApplicationContext appContext;
    private final InputMapper inputMapper;
    private final GuiEngine engine;

    private boolean guiEnabled = false;

    public GuiCursorControlListener(GuiEngine engine) {
        this.engine = engine;
        if (GuiGlobals.getInstance() == null || GuiGlobals.getInstance().getInputMapper() == null) {
            this.inputMapper = null;
        } else {
            this.inputMapper = GuiGlobals.getInstance().getInputMapper();

    public void addMappings() {
        System.out.println("TAB bindings mapped");
        inputMapper.map(F_TAB, InputState.Negative, KeyInput.KEY_F);
        inputMapper.addStateListener(this, F_TAB);

    public void removeMappings() {
        System.out.println("TAB bindings unmapped");
        inputMapper.removeMapping(F_TAB, InputState.Negative, KeyInput.KEY_F);
        inputMapper.removeStateListener(this, F_TAB);

    public void valueChanged(FunctionId func, InputState value, double tpf) {
        System.out.println("TAB CALLED: " + func);
        if (value == InputState.Off) {

        if (func == F_TAB) {
            this.guiEnabled = !guiEnabled;
            System.out.println("Cursor Visible: " + guiEnabled);



With tab, the valueChanged function never gets called at all.

1 Like

Lemur has some built in keys assigned already. You have to remove those bindings. I can’t remember what the static group name is. I’ll try find it.


Disable this group.

1 Like

Yep, InputMapper.deactivateGroup(FocusNavigationFunctions.UI_NAV) will disable all UI navigation and thus you can use tab for your own purposes (along with arrow keys, etc.).

Also, I think if you setup your own mappings for tab after you call GuiGlobals.initialize() but before app states are run then it won’t be mapped for UI navigation anymore at all… which may or may not be desirable.

1 Like

That worked great guys! Thank you!

1 Like