"Mouse entered" and tab view items problem

Sorry if this has been answered before, but I’m having a problem with “on mouse entered”.

I have an image that changes when moused over. This image is in a box, in a tab view item (in a tab view), in a window.

I find that it works perfectly if the tab view item that the images to be moused over are in is the one showing when the app first launches. But if the app launches with another tab view item showing and I click to the tab with the images in nothing happens when I mouse over them.

It doesn’t seem to be anything to do with the size or the position of the window because it will keep working when either is changed “ as long as the tab view item with the images was the first one showing. I can skip between the tabs and it will keep working.

Any idea why this might be?

Thanks in advance!

It’s funny you mention this. I have recently noticed that only the tab view item showing at launch will ‘awake from nib’ at application launch. The other tabs will execute their awake from nib handler (if you have any) when you choose to show them but not at application launch.

So my only thought is maybe this fact has something to do with your problem. Maybe something in your code?

Unfortunately I don’t think this is the problem “ at least not directly. The tab with the “on mouse entered” handler is not frontmost when the app is launched, so you might be on to something, but no code is executed in the awake from nib hander. I may be getting myself thoroughly confused, though. All the buttons in the tab work when it’s switched to, but not the mouse entered or mouse exit.

Does the handler get called at all? If you put:

log “in mouse over handler”

inside of the handler does that log to the console? If it does then put log commands after each line in the handler and see which line it fails on.

Nope, doesn’t get logged at all. If it’s the front most tab on launch it gets logged, if it’s not the front most tab it doesn’t. Is there some way force load everything in a tab when it’s gets switched to, perhaps?

I just tried myself and saw the same behavior as you. I then did a search for “mouse entered” and see that’s there’s lots of problems with these mouse events. Here’s one that had a discussion of some solutions. Take a look, maybe it will help. And look through the other search topics, maybe something will help you.

http://bbs.macscripter.net/viewtopic.php?id=22102

Funny thing though, I connected all of the mouse event handlers to an image view in 3 tab view items. In all 3, the right-mouse events worked… click, drag, and even the scroll worked. So maybe one of those will do the trick for you.

Thanks for the link “ I certainly learned a few things even if I didn’t fix my problem! I guess I’ll just set a bunch of invisible buttons and have the user click on the image to change it rather than hover over it.