Changing Field Width to Length of String
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Changing Field Width to Length of String
I have a field of width x.
I have a comma-delimited string of width x + 20.
How can I change the field width to accommodate the string?
The width of the string will depend on the numbers.
Perhaps a fixed-width font (if there is such a thing) would help.
Does the string have a width?
I have a comma-delimited string of width x + 20.
How can I change the field width to accommodate the string?
The width of the string will depend on the numbers.
Perhaps a fixed-width font (if there is such a thing) would help.
Does the string have a width?
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Changing Field Width to Length of String
Hi.
Check out the "formattedWidth" in the dictionary.
Craig Newman
Check out the "formattedWidth" in the dictionary.
Craig Newman
Re: Changing Field Width to Length of String
Craig
formattedWidth doesn't give a consistent result
when divided by the number of items - close but
not exact.
I'll use a graphic with width 10px X number of items.
formattedWidth doesn't give a consistent result
when divided by the number of items - close but
not exact.
I'll use a graphic with width 10px X number of items.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Changing Field Width to Length of String
I cannot think what you have going on. If I place a bunch of text in a field, that text being wider than the field itself so that it runs off the right side, and then (pseudo)
All is right with the world. What are you seeing?
Craig
Code: Select all
set the width of that field to the formattedWidth of that field
Craig
Re: Changing Field Width to Length of String
Hi Ross,
If I understand correctly what you are trying to do
Kind regards
Bernd
If I understand correctly what you are trying to do
yes there are monospaced fonts, on Mac this is e.g. Courier or Monaco. If you have only singel digit numbers or fore each item the same number of digits for your items than it should work.Perhaps a fixed-width font (if there is such a thing) would help.
look at measureText in the dictionary. It gives you the rect of a string.Does the string have a width?
Kind regards
Bernd
Re: Changing Field Width to Length of String
Bernd.
What am I missing with suggesting the formattedWidth? The OP simply wants the field to adjust itself to be able to display a string of any length.
Or at least I think he does. Calculating the width of text by counting the number of chars of a monospaced font surely would work, but seems like a roundabout way to do so, and then limits your font options somewhat, er, drastically.
Craig
What am I missing with suggesting the formattedWidth? The OP simply wants the field to adjust itself to be able to display a string of any length.
Or at least I think he does. Calculating the width of text by counting the number of chars of a monospaced font surely would work, but seems like a roundabout way to do so, and then limits your font options somewhat, er, drastically.
Craig
Re: Changing Field Width to Length of String
What I want to do is bar-graph the fields by the number of items.
Since some have single-digit numbers and some don't just the
digit count (formattedWidth ?) won't give the right answer.
It was just an idea since I have the item count for each
field available so no trouble to use that to change the
width of a graphic.
Thank you gentlemen for your help.
Since some have single-digit numbers and some don't just the
digit count (formattedWidth ?) won't give the right answer.
It was just an idea since I have the item count for each
field available so no trouble to use that to change the
width of a graphic.
Thank you gentlemen for your help.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.