Dirk Meyer wrote on 23/07/08 01:34 PM: > Everytime I read something like this (also in my code) I do not like > that fact that you have to use height for rectangle and a font size > for the label. I guess label should also have a height and calculate > the font size based on it. I will think about how to fix it, not your > problem.
Hmm, that's too bad. Let me give you an idea how I implemented this in DEPRECATED/candy, maybe you can adapt it. Objects have an intrinsic size and a passive property. The intrinsic size is the "native" size, and for example in the case of a text object, it's the width and height of the text when rendered at the given font and size. The passive property defines whether or not a child influences its parent's intrinsic size. So, for a container, the intrinsic size is the minimum size needed to hold all its active (non-passive) children at their relative positions. For a passive object, its extents are its parent's intrinsic size. For an active object, its extents are its parent's extents. >From the perspective of old candy, to solve your problem above, we're create a container and add to it the text object as an active child, and then add the rectangle object as a passive child whose width and height are 100%. Jason. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel