[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSComboBox : how to set the width properly ?
From: |
Quentin Mathé |
Subject: |
Re: NSComboBox : how to set the width properly ? |
Date: |
Sun, 22 May 2005 02:03:13 +0200 |
Le 21 mai 05, à 16:00, Fred Kiefer a écrit :
Stéphane Goujet wrote:
I believe the recommended way to fix the dimensions of a NSComboBox
is to find the widest element in the list and give its width to the
NSComboBox. But there comes a problem : the NSComboBox interprets it
as its total width, including the text field AND the button.
I think this part is correct. The frame has to include both
components. Your problem when setting it from the outside is that you
have no way of knowing the size of the button (currently hardcoded
17x17).
Yes.
It is the same if one uses the sizeToFit method. I find that
totally illogical : NSComboBox calculates the width to fit on the
text field, but then it does not use it to set its own text field
width... instead it substracts from it the button width. So a
sizeToFit never fits, the end of the text is hidden by the button...
This seems to be a real problem. NSComboBoxCell does not implement the
method cellSize, which should return the optimal size for the text
cell plus the button.
I never tested -sizeToFit: I admit.
Quentin, are you going to implement this? If you don't have time, I
could give it a try.
I would like, but I haven't the time now.
In a first step, I would not loop over all the elements, but just
return the two control sizes added up.
What do you mean by "all the elements", NSComboBoxCell only includes a
text cell and a button cell ?
Quentin.
--
Quentin Mathé
qmathe@club-internet.fr