[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Slick Forums • View topic - Unable to create TextField

Slick Forums

Discuss the Slick 2D Library
It is currently Thu Jun 01, 2023 10:44 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Wed Mar 21, 2012 4:11 pm 
Offline

Joined: Wed Mar 21, 2012 4:06 pm
Posts: 5
I have been trying to create a textfield on the screen but I always get an error saying that GameContainer should be casted to GUIContext.
I looked at the GUITest, followed it exactly as it was written there and ran into the same problem.

When I cast it, the application just crashes saying that GameContainer can not be casted to GUIContext.

Any help is appreciated.
Thanks


Top
 Profile  
 
PostPosted: Thu Mar 22, 2012 10:43 pm 
Offline

Joined: Tue Mar 13, 2012 7:42 pm
Posts: 7
Hello ac99, can I get the source code part when you are trying to create a textfield? I can help you better with that hopefully :? .


Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 12:51 am 
Offline

Joined: Wed Mar 21, 2012 4:06 pm
Posts: 5


Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 4:03 am 
Offline

Joined: Tue Mar 13, 2012 7:42 pm
Posts: 7


Attachments:
font.png
font.png [ 8.9 KiB | Viewed 19395 times ]
Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 5:19 am 
Offline

Joined: Tue Mar 13, 2012 7:42 pm
Posts: 7


Attachments:
font.png
font.png [ 34.81 KiB | Viewed 19393 times ]
Top
 Profile  
 
PostPosted: Fri Mar 23, 2012 1:59 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482


Top
 Profile  
 
PostPosted: Mon Mar 26, 2012 4:55 pm 
Offline

Joined: Wed Mar 21, 2012 4:06 pm
Posts: 5
I copied and pasted everything everyone did and didn't have any success. I ended up with the same result of casting to GUIContext. I then thought about that the slick-ae.jar file that I have been using isn't made properly with textfield... so I removed the build path of slick-ae.jar and added slick.jar to the build path and surprisingly enough it works... No more errors!
I guess it's my slick-ae.jar file that has been causing the problem.

Thanks for the help everyone.
Next step for me... fix the slick-ae.jar file!


Top
 Profile  
 
PostPosted: Mon Mar 26, 2012 7:17 pm 
Offline
Oldbie
User avatar

Joined: Thu Jan 13, 2011 4:42 pm
Posts: 349
i have not tested your code, but I believe that unicode font uses dynamic textures in the load glyphs method. By this i mean that the computer has to generate the image instead of loading it from a file. So far, I have not managed to get dynamic textures to work on android, but even if i could, there is a problem with dynamic textures on android. whenever the game loses focus, all of the textures are lost. when you resume the game, the textures loaded from files are automatically re-loaded, but dynamic textures are still lost. it may be possible to rebuild the texture when the game resumes, but is much easier to do what davedes recommended: use bitmap fonts.

_________________
"Artificial intelligence will never be a match for human stupidity" - "Jamos Kennedynos"


Top
 Profile  
 
PostPosted: Mon Mar 26, 2012 8:02 pm 
Offline
Slick Zombie

Joined: Sat Jan 27, 2007 7:10 pm
Posts: 1482
Both TrueTypeFont and UnicodeFont use AWT for font rendering... It's a wonder either would work at all on Android. :|


Top
 Profile  
 
PostPosted: Mon Apr 30, 2012 3:09 am 
Offline

Joined: Wed Mar 21, 2012 4:06 pm
Posts: 5
I'm not sure what I'm doing wrong... but I tried to make a new slick-ae.jar file and i end up with the same problem i had at the beginning.
I also tried to use the gc.getDefaultFont() but I still end up with the same error: "cast argument gc to GUIContext"
(TextField is driving me insane!!!)

Thanks for all the input that has been coming.
Much appreciated.


Top
 Profile  
 
PostPosted: Tue May 01, 2012 8:43 am 
Offline
Regular

Joined: Thu Sep 22, 2011 4:39 pm
Posts: 165
Location: Belgium


Top
 Profile  
 
PostPosted: Tue May 01, 2012 7:16 pm 
Offline

Joined: Wed Mar 21, 2012 4:06 pm
Posts: 5
Awesome, that fixed my problem with the GUIContext thanks mortias!

Now I've run into another problem. When I went to test the textfield on an android device, when selected it doesn't open the virtual keyboard. How would I go about getting the virtual keyboard to show up on when the textfield is selected??


Top
 Profile  
 
PostPosted: Wed May 02, 2012 8:17 am 
Offline
Regular

Joined: Thu Sep 22, 2011 4:39 pm
Posts: 165
Location: Belgium


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
cron
Powered by phpBB® Forum Software © phpBB Group