# Buttons as PopupMenu items : mouse over issue

**URL:** <https://forum.juce.com/t/buttons-as-popupmenu-items-mouse-over-issue/10590>\
**Category:** General JUCE discussion\
**Created:** [June 11, 2013, 11:47am UTC](https://forum.juce.com/t/buttons-as-popupmenu-items-mouse-over-issue/10590 "2013-06-11T11:47:38Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lalala](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/lalala/32/8577_2.png) [@lalala](https://forum.juce.com/u/lalala)\
**Post date:** [June 11, 2013, 11:47am UTC](https://forum.juce.com/t/buttons-as-popupmenu-items-mouse-over-issue/10590/1 "2013-06-11T11:47:38Z")

</div>

It seems that when buttons are in a popupMenu, they never enter in their “mouse over” state.

I tried it with a TextButton and an ImageButton. Any ideas what can goes wrong with that ?

to test it, in the ButtonsPage of the widget demo, I replace the void buttonClicked (Button\*) which is triggered by the animateButton with that :

```auto

    ScopedPointer<ImageButton> imageButton;
    ScopedPointer<TextButton> textButton;
    bool active = false;
    
    void buttonClicked (Button* button)
    {
        if (active)
            return;
        
        Image normalImage = ImageCache::getFromMemory (BinaryData::juce_png, BinaryData::juce_pngSize);
        Image overImage = normalImage.getClippedImage (Rectangle<int> (0, 0, 100, 50));
        
        imageButton = new ImageButton ("imagebutton");
        imageButton->setImages (true, true, true,
                                normalImage, 1., Colour (0x0),
                                overImage, 1., Colour (0x0),
                                Image(), 1., Colour (0x0),
                                0.f);
        
        textButton = new TextButton ("button");
        
        PopupMenu menu;
        
        menu.addCustomItem (1,
                            imageButton,
                            normalImage.getWidth(), normalImage.getHeight(),
                            false);
        
        menu.addCustomItem (2,
                            textButton,
                            normalImage.getWidth(), normalImage.getHeight(),
                            false);
        
        
        menu.showMenuAsync (PopupMenu::Options().withTargetComponent (button)
                            .withItemThatMustBeVisible (1)
                            .withMinimumWidth (100)
                            .withMaximumNumColumns (1)
                            .withStandardItemHeight (jlimit (12, 24, getHeight())),
                            ModalCallbackFunction::forComponent (popupMenuFinishedCallback, this));
    }
    
    static void popupMenuFinishedCallback (int result, ButtonsPage *dtc)
    {
        dtc->active = false;
    }
```
