Rescaling a window to fit it's text
Posted: Mon Sep 21, 2009 15:16
Hi,
Recently we began having the need to display a text in a box and rescale the text widget and the box accordingly so that it won't have big empty spaces when switching the text widget's contents. How do I determine the necesary size of a defaultwindow's text ? I know it is internally clipped for example and trying to use getUnclippedInnerRect()/getInnerRect()/getUnclippedPixelRect() all return me the same sizes as getSize() which is the current size. How do I retrieve the internal size so to speak so I can change the widget's size to fit the text inside it accurately ?
EDIT : Alternatively, is there a way to determine how much space is needed by analyzing the text to be inserted ?
Recently we began having the need to display a text in a box and rescale the text widget and the box accordingly so that it won't have big empty spaces when switching the text widget's contents. How do I determine the necesary size of a defaultwindow's text ? I know it is internally clipped for example and trying to use getUnclippedInnerRect()/getInnerRect()/getUnclippedPixelRect() all return me the same sizes as getSize() which is the current size. How do I retrieve the internal size so to speak so I can change the widget's size to fit the text inside it accurately ?
EDIT : Alternatively, is there a way to determine how much space is needed by analyzing the text to be inserted ?