Jump to content

[SOLVED] Problem setting button height


photo

Recommended Posts

Hi all,

I'm using Unigine 2.7.1.
I've realized button background is not scaled when a custom height is set. This doesn't happen with button width.

With the following code...

<?xml version="1.0" encoding="utf-8"?>
<ui version="1.0">
  <vbox name="root_vbx" space_y="8">
    <font size="45" face="fonts/opensans-regular.ttf" voffset="4">
      <button width="644" height="83">
        <text align="center" rich="1">BUTTON <font face="fonts/opensans-light.ttf">1</font></text>
      </button>
      <button width="644">
        <text align="center" rich="1">BUTTON <font face="fonts/opensans-light.ttf">2</font></text>
      </button>
      <button width="644">
        <text align="center" rich="1">BUTTON <font face="fonts/opensans-light.ttf">3</font></text>
      </button>
      <button width="644">
        <text align="center" rich="1">BUTTON <font face="fonts/opensans-light.ttf">4</font></text>
      </button>
    </font>
  </vbox>
</ui>

I get this visual result:

image.png.6f2dbcb2eadea8a0a7b0ede3f5f0cea3.png

The space is taken into account, but the button image is not resized to fill this space.

Regards.

Link to comment

Hello,

WidgetButton doesn't take into account height set by user in rendering and events handling. That seems to be a bug and we'll fix it. For now only way I found to get to button's height (beside font's height) is using texture. Using 1x83 transparent placeholder image through "texture" attribute forces the button to set desired height

  • Like 1
Link to comment
  • morbid changed the title to [SOLVED] Problem setting button height
×
×
  • Create New...