Nifty GUI - textfield `@' on Windows

Hi,



If I’m trying to input an `@’ to a Nifty GUI textfield on a Windows system, the textfield does not do anything. It is able to paste this character from the clipboard.



On Linux it works fine.



Any ideas how to solve this issue? Is it an (non-) UTF-8 issue?



Dirk.

Works on Mac as well o_O



Since my move to Mac 2 years ago I’m kinda scared of my old windows machine :smiley:



Do you have any chance to investigate that a bit further? e.g. debug? This is probably a keyboard event translation problem somewhere …

Yes, I can try to debug the issue if you give me instructions how to do that.



But before I must setting up an Development Environment under Windows. It seems that I must use Maven to build the Nifty GUI?

jMP supports building maven projects no problem

Kewl :),



but I’m a console user :wink: … I will try to use cygwin+maven. If I will get trouble I’m using jMP …



Thanks for th hint :slight_smile:

Btw, you sure the @ sign is even in the font bitmap?

@Normen: I hope so! :slight_smile: Just tested with the 1.3 Demo: http://nifty-gui.sourceforge.net/webstart/nifty-default-controls-examples-1.3.jnlp and @ works in all textfields as well as the console window on my mac. I’ll check this on a windows system later too (fears)

@normen: Yes the same binaries+assets are working on a Linux system.



I’ll try to debug the nifty gui on a windows system at tomorrow. I’ll give a feedback after browsing the nifty code :slight_smile:



See you,

Dirk.

1 Like

Patch: http://www.user.tu-berlin.de/ldirk/etc/r1676-german-at.diff



OK, I have found the issue. I’m not sure if it is the right way to fix it, but the patch seems to be work:



On a German keyboard you must press AltGr+Q to input an `@’. Additionally on Windows AltGr it is equivalent to leftCtrl+leftAlt. But in the code the character was set to zero if Ctrl is pressed. That was the issue.



Greets, Dirk.



[patch]Index: src/main/java/de/lessvoid/nifty/input/keyboard/KeyboardInputEvent.java

===================================================================

— src/main/java/de/lessvoid/nifty/input/keyboard/KeyboardInputEvent.java (revision 1676)

+++ src/main/java/de/lessvoid/nifty/input/keyboard/KeyboardInputEvent.java (working copy)

@@ -188,7 +188,15 @@

this.keyDown = newKeyDown;

this.shiftDown = newShiftDown;

this.controlDown = newControlDown;

  • if (controlDown) {

    +
  • /* German keyboard layout: `@’ <=> AltGr + Q
  • *<br />
    
  • * On Windows we are getting the keycodes (on down):<br />
    
  • *   1. 0x1D (left Ctrl)<br />
    
  • *   2. 0xB8 (right Alt)<br />
    
  • *   3. 0x10 (Q) + Character '@'<br />
    
  • */<br />
    
  • if (this.character != ‘@’ && controlDown) {

    this.character = 0;

    }

    }

    [/patch]

Ah, I see! Thanks Dirk! :slight_smile:



Seems like Nifty is currently ignoring the Alt key completly o_O I’ll need to check this when the migration to git is complete :slight_smile:

Hi,

sorry to dig this thread out of it’s grave but for me it’s still not working with nifty 1.3 / 1.3.2 or 1.4.
I can’t input an @ with german keyborad on windows.
I could copy paste it but not enter it via Control + Alt + Q or AltGr + Q.

Is there a known workaround or is there a fault with my pc/java/jme3 ?

greets

Crap! :slight_smile: Seems like I forgot about that one! >_<

@highfice86 I think this is still missing in Nifty unfortunately. I’ve now created an issue on github for this

and will take a look as soon as possible.

Hi guys,
I am having an wierd problem displaying Text, can anyone tell me where im going wrong.
The code is as below:

First I create the screen as follows:

Screen screen = new ScreenBuilder(“start”) {{
layer(new LayerBuilder() {{
childLayoutVertical();

            panel(new PanelBuilder("sec"){{
                height("60%");
                backgroundColor(de.lessvoid.nifty.tools.Color.BLACK);
                childLayoutAbsolute();
             }});
            
            panel(new PanelBuilder("chatPanel"){{
                height("40%");
                backgroundColor(de.lessvoid.nifty.tools.Color.WHITE);
                childLayoutAbsolute();
             }});                
                                            
            }});
            }}.build(nifty);
        
       nifty.gotoScreen("start");

Then I dynamically add element with text as follows:

// adding
Element chatPanel = nifty.getCurrentScreen().findElementByName(“chatPanel”);
PanelBuilder pb = new PanelBuilder(){{
width(“53”);
height(“53”);
x(“200”);
y(“0”);
childLayoutCenter();
backgroundColor(de.lessvoid.nifty.tools.Color.BLACK);
image(new ImageBuilder(){{
filename(“Interface/1280x960/items/ItemBack.png”);
childLayoutCenter();
image(new ImageBuilder(){{
filename(“Interface/common/QtyBack.png”);
imageMode(“resize:5,2,5,5,5,2,5,2,5,2,5,5”);
x(“11”);
y(“38”);
width(“48”);
height(“12”);
valignBottom();
childLayoutCenter();
text(new TextBuilder() {{
font(“Interface/1280x960/fonts/ItemQty.fnt”);
color("#ffff");
text(“12345678”);
textVAlignCenter();
textHAlignCenter();
}});
}});
}});
}};
pb.build(nifty, nifty.getCurrentScreen(), chatPanel);

In the above case, it is displayed as intended.

Now, if I change the screen panel percentages to 70% and 30%, the text does not appear
The non-working screen code is as follows:

Screen screen = new ScreenBuilder(“start”) {{
layer(new LayerBuilder() {{
childLayoutVertical();

            panel(new PanelBuilder("sec"){{
                height("70%");
                backgroundColor(de.lessvoid.nifty.tools.Color.BLACK);
                childLayoutAbsolute();
             }});
            
            panel(new PanelBuilder("chatPanel"){{
                height("30%");
                backgroundColor(de.lessvoid.nifty.tools.Color.WHITE);
                childLayoutAbsolute();
             }});                
                                            
            }});
            }}.build(nifty);
        
       nifty.gotoScreen("start"); 
Can anyone tell me where I am going wrong? Thanks.

Hi, Nothing wrong with nifty in the above code. It works perfectly as intended.
The problem was with jmonkey camera, as it was very close to the map, i.e. at Vector3f(0f, 10f, 10f);
Changed it to Vector3f(0f, 100f, 100f); and the texts are displaying in the below 30% panel.

I never thought jmonkey camera or models would affect nifty display.

void and I were just looking at this and he’s done a patch/workaround that should fix it.