Slick Forums

Discuss the Slick 2D Library
It is currently Wed Jun 19, 2013 8:23 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Sun Apr 08, 2012 8:55 pm 
Offline

Joined: Sun Apr 08, 2012 8:50 pm
Posts: 4
I'm having an issue with the TWL EditField widget. It seems that the space key does not work. All other keys do work, however. Does anyone know why this might be the case?

I am using a custom input to send keys to the GUI object (class name: CustomTWLInput.) I have verified that correct gui.handleKey(Keyboard.KEY_SPACE, ' ', true / false); calls are made with the correct parameters inside the pollInput method. Focus is correct, because as I said all other keys work. Any help would be much appreciated!


Top
 Profile  
 
PostPosted: Mon Apr 09, 2012 6:33 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1188
Well - the only thing I can say is that LWJGLInput class works correctly in all the demos and you can type a space without issues.

How did you check if space doesn't work - just by looking at the rendered text on screen or also by looking at the getText() return value of the EditField?
It might be that your font does not include a space character (very unlikely).

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Wed Apr 25, 2012 4:08 am 
Offline

Joined: Sun Apr 08, 2012 8:50 pm
Posts: 4
MatthiasM wrote:
Well - the only thing I can say is that LWJGLInput class works correctly in all the demos and you can type a space without issues.

How did you check if space doesn't work - just by looking at the rendered text on screen or also by looking at the getText() return value of the EditField?
It might be that your font does not include a space character (very unlikely).


Thanks for the help. My font does include a space character and spaces work throughout the UI. After digging through the TWL source code, I could not find the bug. However, I was able to work around the bug by calling handleKey with a fake keyCode! Example:

gui.handleKey(Keyboard.KEY_SPACE, ' ', true / false); does not work....

gui.handleKey(Keyboard.KEY_A, ' ', true / false); DOES work and in fact space is correctly placed into the editfield.

I am using this workaround for now as the only use of keys is for EditFields. If you have any idea why space keycode seems to be filtered please let me know! Thanks for the help.


Top
 Profile  
 
PostPosted: Wed Apr 25, 2012 5:22 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1188
Did you check with TWL Keyboard Event Debugger ?

Also which Keyboard class do you use?
TWL's Event class has it's own KEY_* constants which should be equal to LWJGL 2.4.x - 2.8.x. Maybe you need to translate them?

I'm sure that this problem is 100% with your code - as it is working for everyone else. Maybe you should post your complete input code?

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group