[SOLVED] Child controls
Posted: Wed Feb 17, 2010 00:02
Hello,
I seem to be having trouble with a custom control:
It works fine when one of these is instantiated from a layout file:
But it does not work when I try to define this as a child control in a looknfeel file:
The button does show up but there is not an image on it. Also if I try to put text on it, that doesn't work either. I am confused why it works from the layout file but not as a child within another control. I'm stumped at the moment and any help would be appreciated. I realize there are several details I have not included. Please let me know what I can elaborate on.
Thanks!
PS Here is the complete snippet of the parent control from the looknfeel file. This control is a "SplitButton" and I used Combobox for inspiration.
I seem to be having trouble with a custom control:
Code: Select all
<!--
***************************************************
ProcerusLook/IconButton
***************************************************
-->
<WidgetLook name="ProcerusLook/IconButton">
<PropertyDefinition name="IconImage" initialValue="" redrawOnWrite="true" />
<PropertyDefinition name="VertImageFormatting" initialValue="TopAligned" redrawOnWrite="true" />
<PropertyDefinition name="HorzImageFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<PropertyDefinition name="ImageAreaRect" initialValue="{{0,0},{0,0},{1,0},{1,0}}" redrawOnWrite="true" layoutOnWrite="true"/>
<PropertyDefinition name="VertTextFormatting" initialValue="TopAligned" redrawOnWrite="true" />
<PropertyDefinition name="HorzTextFormatting" initialValue="CentreAligned" redrawOnWrite="true" />
<PropertyDefinition name="TextAreaRect" initialValue="{{0,0},{0,0},{1,0},{1,0}}" redrawOnWrite="true" layoutOnWrite="true"/>
<PropertyDefinition name="ButtonColor" initialValue="ff1e3cba" redrawOnWrite="true"/>
<PropertyDefinition name="NormalHighlightColor" initialValue="tl:ff8fa1ed tr:ff8fa1ed bl:ff1e3cba br:ff1e3cba" redrawOnWrite="true"/>
<PropertyDefinition name="PushedHighlightColor" initialValue="tl:ff1e3cba tr:ff1e3cba bl:ff8fa1ed br:ff8fa1ed" redrawOnWrite="true"/>
<PropertyDefinition name="HoverHighlightColor" initialValue="ff131352" redrawOnWrite="true"/>
<Property name="Font" value="ArialBold-8"/>
<ImagerySection name="icon">
<ImageryComponent>
<Area>
<AreaProperty name="ImageAreaRect" />
</Area>
<ImageProperty name="IconImage" />
<VertFormatProperty name="VertImageFormatting" />
<HorzFormatProperty name="HorzImageFormatting"/>
</ImageryComponent>
</ImagerySection>
<ImagerySection name="label">
<TextComponent>
<Area>
<AreaProperty name="TextAreaRect" />
</Area>
<Text/>
<VertFormatProperty name="VertTextFormatting" />
<HorzFormatProperty name="HorzTextFormatting" />
</TextComponent>
</ImagerySection>
<StateImagery name="Normal">
<Layer>
<Section look="ProcerusLook/Button" section="ButtonFace" />
<Section look="ProcerusLook/Button" section="HighlightNormal" />
<Section section="icon" />
<Section section="label" />
</Layer>
</StateImagery>
<StateImagery name="Hover">
<Layer>
<Section look="ProcerusLook/Button" section="ButtonFace" />
<Section look="ProcerusLook/Button" section="HighlightNormal" />
<Section look="ProcerusLook/Button" section="HoverHighlight" />
<Section section="icon" />
<Section section="label" />
</Layer>
</StateImagery>
<StateImagery name="Pushed">
<Layer>
<Section look="ProcerusLook/Button" section="ButtonFace" />
<Section look="ProcerusLook/Button" section="HighlightPushed" />
<Section section="icon" />
<Section section="label" />
</Layer>
</StateImagery>
<StateImagery name="PushedOff">
<Layer>
<Section look="ProcerusLook/Button" section="ButtonFace" />
<Section look="ProcerusLook/Button" section="HighlightNormal" />
<Section section="icon" />
<Section section="label" />
</Layer>
</StateImagery>
<StateImagery name="Disabled">
<Layer>
<Section look="ProcerusLook/Button" section="ButtonFace" >
<Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
</Section>
<Section look="ProcerusLook/Button" section="HighlightNormal" >
<Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
</Section>
<Section look="ProcerusLook/Button" section="HoverHighlight" >
<Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
</Section>
<Section section="icon" >
<Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
</Section>
<Section section="label" >
<Colours topLeft="FF7F7F7F" topRight="FF7F7F7F" bottomLeft="FF7F7F7F" bottomRight="FF7F7F7F" />
</Section>
</Layer>
</StateImagery>
</WidgetLook>
It works fine when one of these is instantiated from a layout file:
Code: Select all
<Window Type="ProcerusLook/IconButton" Name="ModeButtons/UAVModes/TestButton2" >
<Property Name="Font" Value="ArialBold-10" />
<Property Name="Text" Value="Stuff" />
<Property Name="IconImage" Value="set:ProcerusLook image:SplitButton" />
<Property Name="VertImageFormatting" Value="CentreAligned" />
<Property Name="HorzImageFormatting" Value="CentreAligned" />
<Property Name="ImageAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
<Property Name="VertTextFormatting" Value="CentreAligned" />
<Property Name="HorzTextFormatting" Value="CentreAligned" />
<Property Name="TextAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
<Property Name="Tooltip" Value="Go to GPS Home" />
<Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
<Property Name="UnifiedPosition" Value="{{0.0,0},{0.0,0.0}}" />
<Property Name="UnifiedSize" Value="{{0,54},{0,60}}" />
</Window>
But it does not work when I try to define this as a child control in a looknfeel file:
Code: Select all
<Child type="ProcerusLook/IconButton" nameSuffix="__auto_dd_button__">
<Area>
<Dim type="LeftEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="TopEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="Width" >
<AbsoluteDim value="50"/>
</Dim>
<Dim type="Height" >
<AbsoluteDim value="50"/>
</Dim>
</Area>
<Property Name="Text" Value="Stuff" />
<Property Name="IconImage" Value="set:ProcerusLook image:SplitButton" />
<Property Name="VertImageFormatting" Value="CentreAligned" />
<Property Name="HorzImageFormatting" Value="CentreAligned" />
<Property Name="ImageAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
<Property Name="VertTextFormatting" Value="CentreAligned" />
<Property Name="HorzTextFormatting" Value="CentreAligned" />
<Property Name="TextAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
</Child>
The button does show up but there is not an image on it. Also if I try to put text on it, that doesn't work either. I am confused why it works from the layout file but not as a child within another control. I'm stumped at the moment and any help would be appreciated. I realize there are several details I have not included. Please let me know what I can elaborate on.
Thanks!
PS Here is the complete snippet of the parent control from the looknfeel file. This control is a "SplitButton" and I used Combobox for inspiration.
Code: Select all
<!--
***************************************************
ProcerusLook/SplitButton
***************************************************
-->
<WidgetLook name="ProcerusLook/SplitButton">
<Child type="ProcerusLook/Button" nameSuffix="__auto_primary_button__">
<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">
<FontDim type="LineSpacing" padding="10" />
</DimOperator>
</UnifiedDim>
</Dim>
<Dim type="Height" >
<FontDim type="LineSpacing" padding="10" />
</Dim>
</Area>
</Child>
<Child type="TaharezLook/ComboDropList" nameSuffix="__auto_droplist__">
<Area>
<Dim type="LeftEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="TopEdge" >
<WidgetDim widget="__auto_primary_button__" dimension="BottomEdge" />
</Dim>
<Dim type="Width" >
<UnifiedDim scale="1" type="Width" />
</Dim>
<Dim type="BottomEdge" >
<UnifiedDim scale="1" type="BottomEdge" />
</Dim>
</Area>
</Child>
<Child type="ProcerusLook/IconButton" nameSuffix="__auto_dd_button__">
<Area>
<Dim type="LeftEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="TopEdge" >
<AbsoluteDim value="0" />
</Dim>
<Dim type="Width" >
<AbsoluteDim value="50"/>
</Dim>
<Dim type="Height" >
<AbsoluteDim value="50"/>
</Dim>
</Area>
<Property Name="Text" Value="Stuff" />
<Property Name="IconImage" Value="set:ProcerusLook image:SplitButton" />
<Property Name="VertImageFormatting" Value="CentreAligned" />
<Property Name="HorzImageFormatting" Value="CentreAligned" />
<Property Name="ImageAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
<Property Name="VertTextFormatting" Value="CentreAligned" />
<Property Name="HorzTextFormatting" Value="CentreAligned" />
<Property Name="TextAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
</Child>
<StateImagery name="Enabled" />
<StateImagery name="Disabled" />
</WidgetLook>