TabBarButton event click?


#1

Hi all !

I would like to know how to get event click on TabBarButton ?

In my DemoTabbedComponent() :

void DemoTabbedComponent::addNewTabb(String name)
{
    addTab (name, Colours::darkgrey, new ButtonsPage(), true);

    getTabbedButtonBar().getTabButton (0)->setExtraComponent (new CloseTabButton(), TabBarButton::afterText);
}

 

my class CloseTabButton()

class CloseTabButton  : public Component
    {
    public:
        CloseTabButton()
        {
            setSize (20, 20);
        }
        
        void paint (Graphics& g)
        {
            Path star;
            star.addStar (Point<float>(), 7, 1.0f, 2.0f);
            
            g.setColour (Colours::green);
            g.fillPath (star, star.getTransformToScaleToFit (getLocalBounds().reduced (2).toFloat(), true));
        }

        void clicked()
        {
           //here, i want to get the event click

            AlertWindow::showMessageBox(AlertWindow::NoIcon, "Message","click tab");
        }
        void mouseDown (const MouseEvent&)
        {
   
        }
    };