Slick Forums

Discuss the Slick 2D Library
It is currently Fri May 24, 2013 8:49 am

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Theme Border vs. Inset
PostPosted: Sat Jul 14, 2012 6:04 pm 
Offline

Joined: Thu Nov 05, 2009 3:38 pm
Posts: 21
Hi,

I just wondered what the meaning/function of "Border" and "Inset" of an area in the theme is. In the theme editor I played around a little bit with these properties and viewed the results in a little example program of two buttons which are in an horizontal box layout.

"Inset" of an "area" seems to control where the image is aligned at the widget. This was used with negative values to achieve the glow effect in the Eforen theme, right? To have the ability to let the image start "outside" (upper and left) of the actual widget, if I understood correctly... ?

The "Border" properties of the "area" does not seem to have any effect on the widget. I tried to get a little gap between the two buttons. Ok, I know, in the box layout I can do this via the "spacing" attribute. But I thought there is some general border property for a widget. The "param-border" as child of a "theme" node does somehow only control the border "inside" of a widget, like the border around the text of a button, but not a border around the widget. Thats what I would have expected...

Thanks for an explaination and kind regards,
Stefan


Top
 Profile  
 
PostPosted: Sat Jul 14, 2012 9:02 pm 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1173
You are right.

On an image the inset controls the placement/size of the image in relation to the area of the widget (or where the Java code draws that image). Negative values move the edge outside, positive values inside.
The border parameter on an image does not affect the image, but it is stored on that image.

On the theme you can then do this:
Code:
<param name="background"><image>.....</image></param>
<param name="border"><border>background.border</border></param>
This will extract the border value stored on the image and use it for that widget.
This allows you to define the border together with the other image parameters.

The term "background.border" is no magic value or anything - it is a java bean property: it looks up the "background" element first in the local scope and if that failed it tries the global scope. After the element was found it tries to access the bean property "border". Images also have other properties like "width" and "height", fonts have properties like "eM", "eX", "lineHeight", "spaceWidth", "baseLine" etc.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sun Jul 15, 2012 1:02 am 
Offline

Joined: Thu Nov 05, 2009 3:38 pm
Posts: 21
Ok, I tried this, and unfortunately a cannot get it running with "background.border"...

But even if it would work, would this set the "inner" border of the button (the property which I could set by hand on the button theme itself), or would it make the border around the widget. Anyway, is there something like a border around a widget in TWL at all?


Top
 Profile  
 
PostPosted: Sun Jul 15, 2012 6:25 am 
Offline
Slick Zombie

Joined: Fri Jan 29, 2010 7:02 pm
Posts: 1173
The widget borders are all inside. Outside borders are handled by the layout - eg for DialogLayout it uses gaps.

And the "background.border" must work - it is used a lot in the example and theme editor themes.

_________________
TWL - The Themable Widget Library


Top
 Profile  
 
PostPosted: Sun Jul 15, 2012 1:23 pm 
Offline

Joined: Thu Nov 05, 2009 3:38 pm
Posts: 21
Ok, I've got to play around with this a little more...
Thanks for the explaination!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 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