Page 1 of 1

Label width by content

Posted: Wed May 25, 2016 11:06 pm
by ahj_dk
Hi,

Is it possible to scale a labels width to the content ?

I need a label to show different status messages, like "error adding to basket", "qty not a number" and so on.

I could add multiple labels where I set the caption and a fixed width, and show/hide these, but it would be easier if one label could be resized.

Re: Label width by content

Posted: Thu May 26, 2016 8:59 am
by Stewart Marshall
Hi Allan

VL has never had content sizing. It has always been the case that the defined bounds of a control, i.e. it's Width and Height properties, define its size, and the content is therefore squashed to fit.

However, the GOOD NEWS is that as of 14 SP1, Table Layout has been enhanced to support content sizing. It is now possible for a control, e.g. Label, Button, Panel, and even a List, to grown to accommodate the content. Thus, as a caption for a button changes, it can get wider. If there are other controls flowing based on the first button, they will move. Similarly, a list can get longer as items are added, making the whole page longer.

Effectively, VL now offers the best of both sizing models, and of course, this is all visible at design time.

SP1 development will finish very soon, so you can expect it in the next couple of months or so...hopefully.