|
Height of textbox when wrapped |
Posted by AT on Jul-02-2013 18:02 |
|
Hi Peter, not sure if this is a bug in CD or just a limitation. I can't get the correct height of
a textbox when the text inside it is wrapped. I'm calling setMaxWidth() to wrap the text if
too long. The height returned by getHeight() is as if it's one line only, any idea why? Need
to know the exact height when wrapped so that I can adjust the object below it
accordingly.
Thanks. |
Re: Height of textbox when wrapped |
Posted by Peter Kwan on Jul-03-2013 01:47 |
|
Hi AT,
Is it possible to provide a short example using hard coded data, so I can try to reproduce the problem?
I have just tried myself using the "Simple Bar Chart" sample code, by adding the following code:
$t = $c->addText(0, 100, "1234 5678");
$t->setMaxWidth(40);
$h = $t->getHeight();
$c->addTitle("Height = $h");
The above code should display the height of the text box in the chart title. I found that it works correctly. If setMaxWidth(40) is used, the height is for two lines. If I remove the setMaxWidth(40), the height is for one line.
Regards
Peter Kwan |
Re: Height of textbox when wrapped |
Posted by AT on Jul-03-2013 10:30 |
|
Hi Peter, I'm actually using addTitle() method. addText() method returns the correct height
even when wrapped, that's why I'm confused since I believe that addTitle() will return a
textbox object similar to that of addText(). Part of the code below.
$title_obj = $c->addTitle($this->chartTitle);
$this->chart_title_height = $title_obj->getHeight();
$title_obj->setMaxWidth($c->getWidth() - 6); |
Re: Height of textbox when wrapped |
Posted by AT on Jul-03-2013 11:39 |
|
Hi Peter, got it now. Should have called getHeight() after setMaxWidth(). Thanks for the
time. |
|