There are 20 buttons in the MianComponent of the juce gui project, I need that if the mouse enters the coordinates of any of the buttons while the left mouse button is pressed down, the button will be pushed down too. I have used event.mods.isLeftButtonDown() as the follow shows, but while the left mouse button is pressed , it doesn’t work at all.
MianComponent.h:
juce::TextButton sbutton[20]
MianComponent.cpp
void MainComponent::mouseMove(const juce::MouseEvent& event)
{
if (event.mods.isLeftButtonDown())
{
// print code
std::string message2 = "event.mods.isLeftButtonDown() :\n";
OutputDebugStringA(message2.c_str());
for (int i = 0; i < 20; ++i) {
if (sbutton[i].getBounds().contains(event.getPosition()))
{
sbutton[i].ButtonPushed(i); // customize ButtonPushed()
}
}
}