setToolTip and NSMatrix of NSButton

Ask a Question related to Mac Programming, Design and Development.

  1. #1

    Default setToolTip and NSMatrix of NSButton

    What is wrong with this code:

    matrix_of_but is a NSMatrix of NSButton
    NSButton *but;

    but = [matrix_of_but cellAtRow:0 column:0];
    [but setToolTip: @"tool"];


    CW report this error (for the last line)

    .... Unknown class Selection_View in Interface Builder file.
    ....*** -[NSButtonCell setToolTip:]: selector not recognized
    ....An uncaught exception was raised
    ....*** Uncaught exception: <NSInvalidArgumentException> *** -[NSButtonCell
    setToolTip:]: selector not recognized
    Alain Birtz Guest

  2. Similar Questions and Discussions

    1. Cocoa: NSMatrix, change number of cells, can't target new ones
      I have an NSMatrix of buttons. They work fine and the target is called when I click on one of them. I've set it up as just -...
    2. Cocoa: detecting click in NSMatrix
      Okay, how the hell am I meant to do this ? I've set an IBAction as the target for my matrix and my routine does actually get called when the user...
    3. keyDown: in NSMatrix subclass
      In <znu-55B7B3.11560309072003@news.fu-berlin.de> ZnU wrote: I presume you remembered to dick around with acceptsFirstResponder? When that...
  3. #2

    Default Re: setToolTip and NSMatrix of NSButton

    In article <abz-3007031606530001@192.168.1.3>,
    [email]abz@videotron.ca[/email] (Alain Birtz) wrote:
    > What is wrong with this code:
    >
    > matrix_of_but is a NSMatrix of NSButton
    > NSButton *but;
    >
    > but = [matrix_of_but cellAtRow:0 column:0];
    > [but setToolTip: @"tool"];
    You're somewhat mistaken. An NSMatrix holds NSCell (or subclass)
    objects. If the matrix has a bunch of buttons, then it's got a bunch of
    NSButtonCell objects, not NSButtons.
    > CW report this error (for the last line)
    >
    > ... Unknown class Selection_View in Interface Builder file.
    > ...*** -[NSButtonCell setToolTip:]: selector not recognized
    > ...An uncaught exception was raised
    > ...*** Uncaught exception: <NSInvalidArgumentException> *** -[NSButtonCell
    > setToolTip:]: selector not recognized
    And that's where this error comes from. You retreived an NSButtonCell
    and called -setToolTip on it. But NSButtonCell does not implement
    -setToolTip.

    You probably want to be using -[NSMatrix setToolTip:forCell].

    --
    Tom "Tom" Harrington
    Macaroni, Automated System Maintenance for Mac OS X.
    Version 1.4: Best cleanup yet, gets files other tools miss.
    See [url]http://www.atomicbird.com/[/url]
    Tom Harrington Guest

Posting Permissions

  • You may not post new threads
  • You may 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