the toObject argument should be your script, so “me”. What is myData? Is it an array or dictionary? I can’t really tell about the withKeyPath argument without knowing more about what they are.
I replaced the object by “me”.
The cell is a NSButtonCell in a matrix.
The card is a dictionary in a controller array.
I do this in a loop, when the matrix is initialized:
repeat with theCard in gCardController's arrangedObjects()
set theCell to (mMap of mRecord)'s cellAtRow_column_(theCard's cMapV,theCard's cMapH)
theCell's setImage_(NSImage's imageNamed_("Locus"))
-- (mMap of mRecord)'s setToolTip_forCell_(theCard's cName,theCell) -- this works
theCell's bind_toObject_withKeyPath_options_("toolTip",me,theCard's cName,missing value)
end repeat
The message says:
What is the meaning of “this class”? NSButtonCell or my script? Does it mean:
Mmh, I think you’re right: neither NSButtonCell nor its ancestors has a setToolTip: method (or even a toolTip instance variable). Rats. Ok, I’ll do this via the matrix.
I don’t think you’re going to be able to do this with bindings since the matrix itself only has one toolTip. Unless theCard’s cName will be changing often for any particular cell, then using setToolTip_forCell_ will work fine. If you really want to use bindings, then you’d probably need to subclass NSCell to expose a new binding for toolTip. In any case your syntax in the binding statement is still wrong, the keyPath needs to be a string, and if “cName” is a key in theCard, then the forKeyPath argument should be “theCard.cName” (including the quotes).
Thank you again, Ric, it was just cosmetics. If one day, in a distant future, I meet a user who asks me “Why is the name into the tool tip not updated when I change the name of the card?” I’ll congratulate him for sure :lol:
I keep my working method. I confess I did something not really HIG to make my tool tips more reactive: