Professional Web Applications Themes

Cocoa: NSComboBoxCell in NSTableColumn - Mac Programming

Hi, my application uses a NSTableView with one NSTableColumn, which needs a combobox instead of a texfield as the data-cell. Creating a NSComboBoxCell-object and setting the data-cell of the NSTableColumn-object works fine. But the combo-box doesn't look good with this big blue down-pointing arrow in the table. I recognized that Interface Builder uses in the Class-inspector-panel a table-column with a combo-box. But this combo-box has as small black double-arrow (pointing up and down) and I can't figure out, how to create such a combo-box. Any hints? thanks in advance Christian...

  1. #1

    Default Cocoa: NSComboBoxCell in NSTableColumn

    Hi,

    my application uses a NSTableView with one NSTableColumn, which needs
    a combobox instead of a texfield as the data-cell. Creating a
    NSComboBoxCell-object and setting the data-cell of the
    NSTableColumn-object works fine. But the combo-box doesn't look good
    with this big blue down-pointing arrow in the table.

    I recognized that Interface Builder uses in the Class-inspector-panel
    a table-column with a combo-box. But this combo-box has as small black
    double-arrow (pointing up and down) and I can't figure out, how to
    create such a combo-box.

    Any hints?

    thanks in advance

    Christian
    Christian Witt Guest

  2. #2

    Default Re: Cocoa: NSComboBoxCell in NSTableColumn

    [email]christian.wittepost.de[/email] (Christian Witt) wrote in message news:<50052383.0309101102.5d000cb7posting.google. com>...
    > Hi,
    >
    > my application uses a NSTableView with one NSTableColumn, which needs
    > a combobox instead of a texfield as the data-cell. Creating a
    > NSComboBoxCell-object and setting the data-cell of the
    > NSTableColumn-object works fine. But the combo-box doesn't look good
    > with this big blue down-pointing arrow in the table.
    >
    > I recognized that Interface Builder uses in the Class-inspector-panel
    > a table-column with a combo-box. But this combo-box has as small black
    > double-arrow (pointing up and down) and I can't figure out, how to
    > create such a combo-box.
    >
    > Any hints?
    >
    > thanks in advance
    >
    > Christian
    Hi Christian,

    I'm also trying to create a nicer combobox in the NSTableView, if
    you've figured this out, please let me know.

    Thanks

    Moray
    M Taylor Guest

  3. #3

    Default Re: Cocoa: NSComboBoxCell in NSTableColumn

    M Taylor <bigmugenfreeuk.com> wrote:
    >>
    >> Any hints?
    >>
    Equivalent code with a popup:

    -(void)awakeFromNib{
    int count;
    id klantPopUpCell;
    klantPopUpCell = [[[NSPopUpButtonCell alloc] initTextCell: "" pullsDown: NO] autorelease];
    for (count = 0; count < 4; count++)
    {
    [klantPopUpCell insertItemWithTitle: [NSString stringWithFormat: "Klant %i", count] atIndex: count];
    }
    [klantPopUpCell setEditable: YES];
    [klantPopUpCell setBordered: NO];
    [[tableView tableColumnWithIdentifier: "Klant"] setDataCell: klantPopUpCell];
    }

    The problem with NSPopUpButtonCells is that they don't have a datasource.
    So you might have to override
    -(void)tableView:(NSTableView*)aTableView
    willDisplayCell:(id)aCell
    forTableColumn:(NSTableColumn*)aColumn
    row:(int)rowIndex;
    to fill the popup if the menu is different for each row.

    -(id)tableView:(NSTableView*)aTableView
    objectValueForTableColumn:(NSTableColumn*)theColum n
    row:(int)rowIndex;
    expects a number for the currently selected menuitem.

    Stephan Eggermont
    Sensus, systems that make sense
    Stephan Eggermont Guest

  4. #4

    Default Re: Cocoa: NSComboBoxCell in NSTableColumn

    Stephan Eggermont <stephanstack.nl> wrote in message news:<bk4gk6$hda$2news.tue.nl>...
    > Equivalent code with a popup:
    > The problem with NSPopUpButtonCells is that they don't have a datasource.
    > So you might have to override
    > -(void)tableView:(NSTableView*)aTableView
    > willDisplayCell:(id)aCell
    > forTableColumn:(NSTableColumn*)aColumn
    > row:(int)rowIndex;
    The next problem with NSPopUpButtonCell is, that it does not behave
    like a textfield and has no autocompletion. I want the behaviour of an
    NSComboBoxCell but not that ugly blue arrow.

    Ciao

    Christian
    Christian Witt Guest

  5. #5

    Default Re: Cocoa: NSComboBoxCell in NSTableColumn

    Christian Witt <christian.wittepost.de> wrote:
    > The next problem with NSPopUpButtonCell is, that it does not behave
    > like a textfield and has no autocompletion. I want the behaviour of an
    > NSComboBoxCell but not that ugly blue arrow.
    I've tried that, and it seems that there are some bugs in NSComboBoxCell.
    The position and size of the 'blue arrow' are wrong. Not that the
    PopUpButton is any better, though. Just put one on a window, and
    make it small, pulldown, square and do a size to fit.

    Stephan
    Stephan Eggermont Guest

Similar Threads

  1. Visibility of Cocoa objects
    By Eric VERGNAUD in forum Mac Programming
    Replies: 6
    Last Post: September 13th, 07:34 PM
  2. Bit shifts in Cocoa
    By Korbin Meiser in forum Mac Programming
    Replies: 2
    Last Post: September 11th, 01:11 AM
  3. Q About Cocoa & CF Prefs..
    By David Phillip Oster in forum Mac Programming
    Replies: 2
    Last Post: July 31st, 12:04 PM
  4. Cocoa Filemaker
    By Olly Groves in forum FileMaker
    Replies: 2
    Last Post: July 25th, 01:55 AM
  5. [Cocoa] Bug with NSTableView?
    By Mark Bee in forum Mac Programming
    Replies: 1
    Last Post: July 7th, 07:38 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139