1

Helo Experts, how to add an action event like button action to tooltip in cocoa,when i click on tooltip i want to perform some action.is it possible in cocoa?.if YES could anybody help how to do this.

I am showing tooltip using NSStatusItem

Thanks in advance.

1 Answers1

0
//tooltip is your NSStatusItem
[tooltip setAction:@selector(tooltipClicked:)];

This calls method tooltipClicked when clicked:

- (void)tooltipClicked:(id)sender { ... }
juniperi
  • 3,723
  • 1
  • 23
  • 30
  • Hi, i have tried this already,but its not calling the method. do u have any idea why its not calling the method.?? I also set the setTarget:self . still its not calling the method why.?? thanks for reply – Dhanunjay Kumar Jul 05 '13 at 07:28
  • The method is not calling becoz the statusItem has the menu.so the action will not be sent if the menu is there.You have to use only one them.i.e,either menu or the action.Not Both. :( – Dhanunjay Kumar Jul 05 '13 at 09:08
  • The above code is for, if u click on status item but not to click on tooltip. – Dhanunjay Kumar Jul 05 '13 at 11:15