Hi Johannes, On Mon, Feb 04, 2008 at 04:19:45PM +0100, Johannes Hofmann wrote:
Hi Jorge,
On Sat, Feb 02, 2008 at 07:23:17PM -0300, Jorge Arellano Cid wrote:
On Sat, Feb 02, 2008 at 07:27:20PM +0100, Johannes Hofmann wrote:
Here is a small patch to compute the size of select widgets similar to the way it is computed for text input widgets. The width is hardcoded to 10 * size of 'M' in the current font.
I committed a different version that measures the string length (as dillo1 and FF). You can test with:
http://www.dillo.org/bugtrack/Dinsert.html
(adding a long string to a local copy is useful).
I doubt that's the right way to do it, but at least it works. Please consider it experimental and give it a look.
I don't think it is valid to compute the size in addItem(). The style may change later, especially in the future with CSS. I would propose to do the size computation in sizeRequest(), even if that looks inefficient (patch below). That way it is consistent with e.g. FltkLabelButtonResource.
Committed with the following comment: // Looks like O(n^2) but the loop is executed one time -> O(n). :-)
While at it, I replaced the hardcoded 20 for the small rectangle on the right with what FLTK uses for the width of the rectangle.
Good. -- Cheers Jorge.-