Skinning How To/Window sizing and resizing

From Second Life Wiki
< Skinning How To
Revision as of 20:46, 1 May 2008 by McCabe Maxsted (talk | contribs) (New page: = 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...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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 floater that controls the search window: floater_directory.xml.

Tutorial

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

<?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="570" min_height="570" min_width="780"
     name="directory" rect_control="FloaterFindRect2" title="Search Second Life"
     width="780">

This code controls the size, positioning, and abilities of the floater that contains the search window.

Toggling resizing

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

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

Change can_resize="" to true 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="570" min_height="570" min_width="780"
     name="directory" rect_control="FloaterFindRect2" title="Search Second Life"
     width="780">

The search window can now be resized.

Default size

The default size of a floater is controlled by height="" and width="" in pixels.

In the code above, you can see that the default height and width are set to height="570" and width="780". The maximum sizes allowed for height and width are 768 by 1024, 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 width="" to 500 and height="" to 200 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="200" min_height="570" min_width="780"
     name="directory" rect_control="FloaterFindRect2" title="Search Second Life"
     width="500">

The default size of the search window is now significantly smaller.

Min and max size

Notice how if you run the viewer now, the default size appears larger than 200x500, though? That is because of the maximum and minimum values.

In the xml files, the maximum and minimum sizes are controlled by 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 with minimum). For the search window, let's set the following:

min_height="100" min_width="300" max_height="600" max_width="800"

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="200" min_height="100" min_width="300"
     name="directory" rect_control="FloaterFindRect2" title="Search Second Life"
     width="500" max_height="600" max_width="800">

The search window now defaults to 200x500 pixels, and can be resized to anywhere between 100x300 and 600x800 pixels.