I’m probably missing something obvious, so please forgive a Juce absolute beginner:
I have a MainWindow with a Component-derived class that displays an image. The component does addMouseListener(this, false) in its constructor. I have stub mouseExit()/mouseEnter() functions that only DBG() the event.
Now the question: It seems that mouseEnter()/mouseExit() always get called twice when the mouse enters/exits. Why? Sample code below
[code]
class FindTramComponent : public Component {
public:
FindTramComponent();
~FindTramComponent();
void paint(Graphics& g);
// mouseListener
void mouseEnter(const MouseEvent &e);
void mouseExit(const MouseEvent &e);
private:
Image tramImage;
};
FindTramComponent::FindTramComponent() {
tramImage = ImageCache::getFromMemory(BinaryData::tram_jpg, BinaryData::tram_jpgSize);
addMouseListener(this, false);
}
void FindTramComponent::paint(Graphics& g) {
g.drawImageAt(tramImage, 0, 0);
}
void FindTramComponent::mouseEnter(const MouseEvent &e) {
DBG(“Hello Mouse!”);
}
void FindTramComponent::mouseExit(const MouseEvent &e) {
DBG(“Good Bye Mouse!”);
}[/code]