This is an example of how you can add a "Client Area" to the FrameWindow type. The main advantage of having a seperate client area window is that this allows you to use relative co-ordinates for your content but have the certainty that the content will never disappear behind the title bar. The trade off is that you add a layer of complexity in accessing the content - maining that you can't query the FrameWindow directly about its content, but rather you have to first obtain access to the 'client area' window and query that instead. Another limitation is that the area for the client region will not update if you turn off the window frame or title bar - so you'd need a new window type for each possibility, but such is life when dealing with workarounds.
Anyhow, the example consists of a modified TaharezLook FrameWindow, what you need is a new client area window part such as in the snippet below, this snippet can be inserted before the other <Child> tags in the WigetLook for TahareaLook/FrameWindow:
Code: Select all
...
<!--
***************************************************
This is where we add in the new child component
for a client area window. Note that the area
defined for this is the same as the named area
ClientWithTitleWithFrame above. We basically
keep the top edge of the client area glued
to the bottom edge of the titlebar - this
way we can ensure that content added to the
client area will never be obscured by the
title bar.
***************************************************
-->
<Child type="DefaultWindow" nameSuffix="__auto_clientarea__">
<Area>
<Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="WindowTopLeft" dimension="Width" /></Dim>
<Dim type="TopEdge" ><WidgetDim widget="__auto_titlebar__" dimension="BottomEdge" /></Dim>
<Dim type="RightEdge" >
<UnifiedDim scale="1" type="RightEdge">
<DimOperator op="Subtract">
<ImageDim imageset="TaharezLook" image="WindowTopRight" dimension="Width" />
</DimOperator>
</UnifiedDim>
</Dim>
<Dim type="BottomEdge" >
<UnifiedDim scale="1" type="BottomEdge">
<DimOperator op="Subtract">
<ImageDim imageset="TaharezLook" image="WindowBottomEdge" dimension="Height" />
</DimOperator>
</UnifiedDim>
</Dim>
</Area>
</Child>
...
And here is a simple layout XML that shows how you add your content to the new FrameWindow type. Note the use of the AutoWindow tag to target the content into a component of the compound FrameWindow.
Code: Select all
<GUILayout>
<Window Type="DefaultGUISheet" Name="root">
<Window Type="TaharezLook/FrameWindow" Name="ATestWindow">
<Property Name="UnifiedPosition" Value="{{0.1,0},{0.1,0}}" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedMinSize" Value="{{0,128},{0,128}}" />
<Property Name="UnifiedSize" Value="{{0.4,0},{0.5,0}}" />
<Property Name="Text" Value="Demo of seperate client area." />
<!--
***************************************************
Notice that the content of this window actually
go inside a child component of the compound
type FrameWindow - this is achieved by the
use of the AutoWindow tag and supplying the
name suffix used when we defined the new
client area component above.
***************************************************
-->
<AutoWindow NameSuffix="__auto_clientarea__" >
<Window Type="TaharezLook/Button" Name="ATestWindow/Button">
<Property Name="UnifiedAreaRect" Value="{{0.02,0},{0.01,0},{0.98,0},{0.15,0}}" />
<Property Name="Text" Value="Don't push me!" />
</Window>
<Window Type="TaharezLook/Button" Name="ATestWindow/Button2">
<Property Name="UnifiedAreaRect" Value="{{0.04,0},{0.6,0},{0.96,0},{0.75,0}}" />
<Property Name="Text" Value="Another button" />
</Window>
</AutoWindow>
</Window>
</Window>
</GUILayout>
Once it's up and running you can see that positions are now based upon the actual client area of the window and that we can use relative co-ords without fear of obscuring the content with the title bar.
This should probably be tidied up, expanded, and put on the main wiki as a tutorial, since most people will not be aware that you can do this type of thing.
HTH
CE.