|
From: | Stéphane Goujet |
Subject: | NSComboBox : how to set the width properly ? |
Date: | Thu, 19 May 2005 10:29:49 +0300 |
User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
Hello,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. 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...
What is the work-around ?For example, how to know the width of the button ? Then I could add it to the frame width and do a setFrame. I saw those values are hardcoded in NSComboBoxCell.m, so I could copy them, but isn't there a proper way to get them ?
Goodbye, Stéphane.
[Prev in Thread] | Current Thread | [Next in Thread] |