Offset does not work with Size To Content

I have a content that is 200x100. I give the container (i.e. Grid Panel or any other) Size To Content = True. That works fine.

Now if I also give the container offsets (i.e. 10,10,10,10), I expect the container to add the offsets and become 220x120. But instead it subtracts the offset from the content. The container will still be 200x100 but the content will now be cut off and become 180x80.

Is there any work around or fix known?

Hello ellocator,

I have a few questions for you that will help narrow down what issue it is that you are experiencing.

Quick questions:

  1. Can you produce this issue in a clean project?
  2. If so, could you provide detailed list of steps to reproduce this issue on our end?
  3. Could you provide screen shots of any widgets that may be involved with this issue?

Hi Rudy,

thanks for the follow-up.

  1. Yes
  2. Create a new UserWidget
  3. Put a Text inside
  4. Write “Hello World”
  5. Wrap Text into Grid Panel
  6. Select Grid Panel
  7. Put Grid Panel at xy 0,0
  8. Put Grid Panel SizeToContent = true
  9. Select “Desired”-viewmode
  10. Drag the Anchor into a Box-Coordinate system
  11. Input offsets 10,10,10,10

Screenshot: http://i.imgur.com/nZhdbGF.png

Observe the Grid Panel is shrinking down and cutting off the content, even though it has Size To Content checked.
The Canvas Panel still has the same size, instead of growing by 20x20.

Hello ellocator,

After following the steps above it appears that this is working as intended. You have set the panel to size itself to its content, however you are then overriding the size of the grid panel but changing it’s anchors and applying an offset.

Make it a great day

I see, so offset is intended to layout a top->bottom (outer->inner) layout. Since I want to use a bottom->up (inner->outer) layout, I can use the Size Box with Padding. That delivers the result I want.

(Still, I can see no situation where SizeToContent + offset makes sense. Since the outer container does still SizeToContent (It’s not a complete override), but then cuts it off by the offset.)