Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
iksarp
Posts: 5
Registered: ‎10-10-2012
My Device: Does it matter

AbsoluteLayout: Cannot change height of a component

Hello,

 

my input is a following set: Component type, position, dimensions(width and height). I thought the easiest way to do so would be using AbsoluteLayout, but I can't set preferred height of a component with following code. No matter what value is preferredHeight, button height is always the same. What am i doing wrong?

 

Page {
   Container {
      objectName: "mainContainer"
      layout: AbsoluteLayout {}

      Button {
         objectName: "button"
         text: "Button"
         preferredWidth: 150
         preferredHeight: 150
         layoutProperties: AbsoluteLayoutProperties {
            positionX: 50
            positionY: 50
         }
      }
   }
}

 

Regular Contributor
ametller
Posts: 54
Registered: ‎07-15-2010
My Device: Not Specified

Re: AbsoluteLayout: Cannot change height of a component

Yes, you are right. It seems you can't change the height of a Button. Two possible solutions would be:

 

1. Create a custom Button. Maybe this way would allow you to modify the height of the component (not sure though, as I have never tried it)

 

2. You can use the scaleY: property of a Button. It works, however the text appears a bit deformed if you only scale the Y axis

 

I hope this helps,

Super Contributor
lyon819
Posts: 253
Registered: ‎08-19-2010
My Device: BB10, Playbook, 9900, 9800, 9700, 9550, 9530, 9500, 8700.

Re: AbsoluteLayout: Cannot change height of a component

I also found the bug before. Just let you know.

So far, you cannot change height of button by preferheight.

 

Cheers,

 

-Fight with BB10