Page 1 of 1

widgetlook's child's Size cann't change ??

Posted: Thu Feb 19, 2009 03:24
by koria
i write a looknfeel like this:

Code: Select all

   <!--
    ***************************************************
        TestLook/ScrollablePane
    ***************************************************
    -->
    <WidgetLook name="TestLook/ScrollablePane">
        <NamedArea name="ViewableArea">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
            </Area>
        </NamedArea>
        <NamedArea name="ViewableAreaHScroll">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" ><UnifiedDim scale="1.0" type="RightEdge" /></Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <NamedArea name="ViewableAreaVScroll">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" ><UnifiedDim scale="1.0" type="BottomEdge" /></Dim>
            </Area>
        </NamedArea>
        <NamedArea name="ViewableAreaHVScroll">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_vscrollbar__" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <WidgetDim widget="__auto_hscrollbar__" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>
        <Child  type="TestLook/HorzScrollbar" nameSuffix="__auto_hscrollbar__">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="Width" ><UnifiedDim scale="1" offset="-12" type="Width" /></Dim>
                <Dim type="Height" ><AbsoluteDim value="12" /></Dim>
            </Area>
            <VertAlignment type="BottomAligned" />
        </Child>
        <Child  type="TestLook/VertScrollbar" nameSuffix="__auto_vscrollbar__">
            <Area>
                <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
                <Dim type="Width" ><AbsoluteDim value="12" /></Dim>
                <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
            </Area>
            <HorzAlignment type="RightAligned" />
        </Child>
        <StateImagery name="Enabled" />
        <StateImagery name="Disabled" />
    </WidgetLook>


when i create the TestLook/ScrollablePane window , i want't to change it's child's Size that 's name "TestLook/VertScrollbar" , but it shows no change .

somebody can't tell me why ?? thanks a lot!!!

Posted: Thu Feb 19, 2009 14:30
by CrazyEddie
Well, as you can see in the WidgetLook specification, you're giving the system a concrete size to be used; that being 12 pixels for the width, and the full height of the parent minus 12 pixels for the height.

If you want to change the size of the scrollbar, you have to modify the specification within the WidgetLook accordingly.

If you want it 24 pixels wide, do this:

Code: Select all

<Child  type="TestLook/VertScrollbar" nameSuffix="__auto_vscrollbar__">
  <Area>
    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
    <Dim type="Width" ><AbsoluteDim value="24" /></Dim>
    <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
  </Area>
  <HorzAlignment type="RightAligned" />
</Child>


If, as I suspect, you want to be able to set the width via a property later, then you need something like this..

At the top of the WidgetLook, you add a property definition for a property that will control the size of the scrollbar:

Code: Select all

<PropertyDefinition name="ScrollbarSize" initialValue="12" layoutOnWrite="true" />


Then, for the definition for the child scrollbar, for example, you might use it like this:

Code: Select all

<Child  type="TestLook/VertScrollbar" nameSuffix="__auto_vscrollbar__">
  <Area>
    <Dim type="LeftEdge" ><AbsoluteDim value="0" /></Dim>
    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
    <Dim type="Width" ><PropertyDim name="ScrollbarSize" /></Dim>
    <Dim type="Height" ><UnifiedDim scale="1" offset="-12" type="Height" /></Dim>
  </Area>
  <HorzAlignment type="RightAligned" />
</Child>


With the above you can control the size of the scrollbar from within layouts and code by setting the property "ScrollbarSize" on the ScrollablePane - in this example the value should be an absolute pixel size.

HTH

CE.