Hi,
I have a menu which allows the user to show different components. I’m using the following code for when a menu item is selected…
void menuItemSelected(int menuItemID, int toplevelMenuIndex)
{
if(menuItemID==1 && toplevelMenuIndex==0){
//to show the home page
delete currentComponent; //currentComponent is initialised to mainWindow in the constructor
mainWindow->setBounds(0, 50, 1000, 550);
this->addAndMakeVisible(mainWindow);
currentComponent = mainWindow;
}
else if(menuItemID==2 && toplevelMenuIndex==0){
//to show the device setup page
delete currentComponent;
setup->setBounds(0, 50, 1000, 550);
this->addAndMakeVisible(setup);
currentComponent = setup;
}
}
My app loads fine and I can bring up the audio device page ok too. However, when I try to return to the home page (mainWindow) the app crashes. I’ve also tried setContentComponent() instead of addAndMakeVisible() but it gives the same result.
Any help is appreciated, I’m sure this is a simple fix.
Thanks…