FAQ  •  Register  •  Login

Custom XML Template : strange alignment issue

Moderator: MiRai

<<

Nadisia

Posts: 8

Joined: Wed Apr 20, 2016 9:51 am

Post Tue Aug 01, 2017 3:49 pm

Custom XML Template : strange alignment issue

Hello all.

I trying to create custon XML Templates for fancy personnal menus, but I do have an issue with alignment between background and buttons.

Just a small exemple, and a small image.

1st, the very simple XML template, 1 vertical column of 4 32x32 buttons :
Code:
<ISUI>
  <template name='MyButton'>
     <Width>32</Width>
     <Height>32</Height>
     <Alpha>1.0</Alpha>
     <BackgroundColor>FF0F0F0F</BackgroundColor>
     <Border>1</Border>
     <BorderColor>FF00FF00</BorderColor>
     <Text>1</Text>
     <Font template='MyButton.Font'>
        <Color>FFFFFFFF</Color>
        <Size>14</Size>
        <Name>prototype</Name>
     </Font>
     <Texture/>
     <TextureHover/>
     <TexturePressed/>
  </template>

  <Window name='4x1_Vert_Template'>
  <Width>32</Width>
  <Height>134</Height> <!-- Window Height = (4 * Button Height size) + 3 * space between buttons , so 4*32 + 3*2 = 134 -->
  <Alpha>1.0</Alpha>
  <BackgroundColor>FFFF0000</BackgroundColor>
  <Border>0</Border>
  <Title>${This.GetMetadata[menu].Escape}</Title>
  <Visible>1</Visible>

     <Children>
        <Frame Name='buttons'>
        <BackgroundColor>00000000</BackgroundColor>
        <Width>100%</Width>
        <Height>100%</Height>

           <Children>

            <Button name='btn1' template='MyButton'>
              <X>15</X>
              <Y>0</Y> <!-- The 1st button should normaly be placed at the top of the window -->
              <Text>Btn1</Text>
            </Button>

            <Button name='btn2' template='MyButton'>
              <X>15</X>
              <Y>34</Y> <!--  2nd button 34 pixels lower , and so on -->
              <Text>Btn2</Text>
            </Button>

            <Button name='btn3' template='MyButton'>
              <X>15</X>
              <Y>68</Y>
              <Text>Btn3</Text>
            </Button>

            <Button name='btn4' Template='MyButton'>
              <X>15</X>
              <Y>102</Y>
              <Text>Btn4</Text>
            </Button>

           </Children>
        </Frame>
     </Children>
  </Window>

</ISUI>


And now, the result :

Image

As you can see, I have a weird vertical shift of about 15 pixels between the top of the "window" element type background and the 1st button (the horizontal shift is obviously normal, set like this to see the red background more clearly)
Is it normal, a bug, or did I missed something? :p

And if it's normal, is there a way to know the exact value of this shift?
<<

bob

User avatar

League of Extraordinary Multiboxers

Posts: 2527

Joined: Sat Feb 15, 2014 11:14 am

Location: In the dining room, with the lead pipe.

Post Tue Aug 01, 2017 4:17 pm

Re: Custom XML Template : strange alignment issue

It's normal, and the shift is 16 pixels. It's for the menu title bar. I normally make my top position in the starting position -16 pixels from where I want it.

e.g. Image
This was for a Top of 0.
<<

Nadisia

Posts: 8

Joined: Wed Apr 20, 2016 9:51 am

Post Tue Aug 01, 2017 4:22 pm

Re: Custom XML Template : strange alignment issue

Great, thanks Bob for the fast reply ;)

Now, I just need to add 16 pixels to my window height.

Return to Menus

Who is online

Users browsing this forum: No registered users and 1 guest