Slick Forums

Discuss the Slick 2D Library
It is currently Sun May 19, 2013 12:52 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Tue May 25, 2010 9:35 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
I tried using an EditField, but I'm unable to interact with it, typing in it etc.


Code:
      EditField editField = new EditField();
      editField.setPosition(200, 200);
      editField.setSize(300, 48);
      editField.setEnabled(true);
      editField.setVisible(true);
      editField.setText("Nothing is displayed");
      editField.addCallback(new EditField.Callback() {
         @Override
         public void callback(int key) {
            System.out.println(key);
         }
      });
      root.add(editField);

The callback gets executed, I can see the editField, but cannot do anything with it.

But when I run it I get this:
Code:
Could not find theme: tooltipwindow
Parameter "cursor" not set for "editfield"
Parameter "selection" not set for "editfield"
Parameter "autocompletion-height" not set for "editfield"
Parameter "passwordChar" not set for "editfield"
Missing child theme "renderer" for "editfield"


Will those warnings result in my EditField not working?

(btw. you really should make TWL use a default internal theme, so you can work your way bottom-up, as opposed to from the top, just as you work with CSS).


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2010 9:39 pm 
Offline
Game Developer
User avatar

Joined: Wed Feb 17, 2010 12:24 am
Posts: 594
Are you using the TWLInputAdapater?

For your theme, including the simple.xml
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE themes PUBLIC "-//www.matthiasmann.de//TWL-Theme//EN" "http://hg.l33tlabs.org/twl/raw-file/tip/src/de/matthiasmann/twl/theme/theme.dtd">

<themes>
   <include filename="simple.xml" />
</themes>


and then you can reference the defaults like so:

Code:
   <theme name="MyConsole" ref="dialoglayout">
      <theme name="scrollpane" ref="scrollpane">
         <theme name="textarea" ref="textarea">
         </theme>
         <theme name="" ref="*" />
      </theme>
      <theme name="editfield" ref="editfield">
         <theme name="" ref="*" />
      </theme>
      <theme name="" ref="*" />
   </theme>


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2010 10:31 pm 
Offline
Game Developer
User avatar

Joined: Tue Nov 21, 2006 4:46 am
Posts: 619
Location: Iceland
Ok, I got it going, thanks.

But it's a total whack. I don't like to start a new project by copying bunch of external files into my new fresh project, and then try to clean it up, trimming it down, removing resources, etc. Oh well...

I don't even know what that MyConsole stuff is doing. :/


Top
 Profile  
 
 Post subject:
PostPosted: Tue May 25, 2010 11:42 pm 
Offline
Game Developer
User avatar

Joined: Wed Feb 17, 2010 12:24 am
Posts: 594
appel wrote:
Ok, I got it going, thanks.

But it's a total whack. I don't like to start a new project by copying bunch of external files into my new fresh project, and then try to clean it up, trimming it down, removing resources, etc. Oh well...


The only two files you need are simple.xml and simple.png. You can strip out things like background and twl logo, etc. That's assuming you want the look/feel of the default windows. You could also build your own if you want to keep it minimal. The only thing you have to do is include a "theme=xxxx" for any widgets you use (and also any textures).

There is also a "gamegui.xml" template. You can modify that for your liking.

Quote:
I don't even know what that MyConsole stuff is doing. :/


It's just saying how the window should be laid out. Each widget has a theme. You can modify those to look like whatever you like. You can either set them all by hand, or build a "window" [dialoglayout] and set the theme on the entire thing. That is, add all widgets to the dialoglayout and then apply theme to dialoglayout widget.

The MyConsole, is just saying "There is a scroll bar, use the default theme for it. There is a textarea, again, just use the default include from simple.xml. etc,etc That is the ref[erence] part.

If you look in simple.xml, you'll see a theme for all these, dialoglayout, scrollpane, etc.


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