This project is read-only.

Variable size label

May 16, 2010 at 6:47 PM

I'm trying to set up something where I have some text in a label, and this label is within a cell of a grid. There may be more text than can be displayed however, so I want to make the label scrollable.

I tried putting the label inside a scrollpanel, then adding the scrollpanel to the grid. This has problems though:

 - because my label has a margin of (3), the label is only as big as the scrollpanel (and thus the cell in the grid), so although you can scroll it, you don't actually get any more text than is initially visible. In addition, the text doesn't display until you put your finger in the cell and wiggle it - like it doesn't draw it right away (although that is probably just some event I need to sort out)

If I omit the Margin setting, then nothing is visible at all (presumably because it has a size of 0 or something). If I try setting the size of the label to something like width = scrollpanel.width, it won't work because in the constructor the size of the control is not populated yet. 

Any thoughts on the best way to achieve this? Thanks!

May 18, 2010 at 9:25 PM

OK, I now fixed all this with a bit of playing- part of the problem was I was setting the size of my label, rather than bounds... this seemed to do the trick. Also invalidating the control on the layout sorted the initial drawing problem.