I was looking for something discussed in following posts.
Gap above NSMenuItem custom view.
Reverse engineering an NSMenu for a Status Bar Item
I tried开发者_Go百科 the carbon code provided by Pierre Bernard
initially, i was getting same error "EXC_BAD_ACCESS on the line InstallControlEventHandler" like other had. I play with the code lots and accidently found the solution.
I have just replaced the InstallControlEventHandler function call to HIViewInstallEventHandler and everything is working fine.
Hope this will help others. Let me know if anyone need further clarification.
Special thanks to Pierre Bernard to provide great code.
Thanks
Just replace the InstallControlEventHandler function call to HIViewInstallEventHandler and code will work fine.
Thanks
精彩评论