[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: NSComboBox
From: |
Chris B. Vetter |
Subject: |
Re: NSComboBox |
Date: |
Mon, 17 Mar 2003 10:11:08 -0800 |
On Mon, 17 Mar 2003 18:54:06 +0100 (CET)
Marko Riedel <mriedel@neuearbeit.de> wrote:
> Hi folks,
> why does an NSComboBox pop up a window when in fact there are no
> entries? How to setup a combo box that works properly even when there
> are no entries (in that case it should behave like an ordinary text
> field, I guess).
Not sure if that's the "official" way, but here's how I do it:
- (void) awakeFromNib
{
[...]
[myComboBox setEnabled: NO];
[myComboBox setAction: @selector(_comboSwitchWord:)];
[...]
return;
}
- (void) _comboSwitchWord: (id) sender
{
if( [myComboBox numberOfItems] > 1 )
[myComboBox setEnabled: YES];
[...]
[myComboBox setNeedsDisplay: YES];
[myComboBox display];
return;
}
NSComboBox-setEnabled: only refers to the "drop down" button, not its
text field...
--
Chris
- NSComboBox, Marko Riedel, 2003/03/13
- NSComboBox, Marko Riedel, 2003/03/17
- Re: NSComboBox,
Chris B. Vetter <=