Skinning How To/Window sizing and resizing

From Second Life Wiki
Jump to navigation Jump to search

Introduction

The default, minimum, and maximum sizes of floaters can all be changed in the viewer xml files, located in your Second Life installation folder under \skins\xui\[Language]. For this example, we will be using the lag meter floater: floater_lagmeter.xml.

Tutorial

Open floater_lagmeter.xml in Komodo or your favorite text editor and you will see the following lines of code at the top of the file:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
     can_resize="false" height="150" name="floater_lagmeter"
     rect_control="FloaterLagMeter" title="Lag Meter" width="350">

The parameters in the <floater> tag control the size, positioning, and user abilities for the lag meter.

Toggling resizing

Resizing is set by the parameter can_resize="" (true or false).

In the example above you can see that can_resize="false", thus preventing the floater from being resized by the user (via the triangle in the lower right).

To allow resizing, change can_resize="" to true. The code should now read:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
     can_resize="true" height="150" name="floater_lagmeter"
     rect_control="FloaterLagMeter" title="Lag Meter" width="350">

The lag meter is now resizable.

Default size

The default floater size is set by the parameters height="" and width="" (in pixels). In the code above, you can see that the default height and width are set to height="150" and width="350".

The maximum sizes for height and width are 768 by 1024 pixels, respectively. However, you will never need to set a floater that big (and shouldn't. Floaters set to full screen will have their lower portions obscured by the toolbar. For more information, see my toolbar tutorial (under construction)).

Let's change the height="" to 500 and to width="" 300 so that the code now reads:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
     can_resize="true" height="500" name="floater_lagmeter"
     rect_control="FloaterLagMeter" title="Lag Meter" width="300">

If you open the lag meter, you'll now notice its height and width are noticeably larger.

Min and max size

The maximum and minimum sizes for floaters are set by the parameters min_height="", min_width="", max_height="" and max_width="" (in pixels). The maximum width is the greatest width the user can resize a floater; the maximum height is the greatest height (and likewise for the minimum).

For the lag meter, let's set the minimum and maximum to the following:

min_height="100" min_width="300" max_height="500" max_width="700"

The code should now read:

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<floater can_close="true" can_drag_on_left="false" can_minimize="true"
     can_resize="true" height="500" name="floater_lagmeter"
     rect_control="FloaterLagMeter" title="Lag Meter" width="300"
     min_height="100" min_width="300" max_height="500" max_width="700">

The lag meter now defaults to 500x300 pixels, and can be resized to anywhere between 100x300 and 500x700 pixels.