Juce Friends,
Hello from Texas. I’m stuck right now on how to delete a component and then have a new component created that is a child of the DocumentWindow. Basically replace a component with a new one in the same DocumentWindow.
This is a login application, and after the user successfully authenticates with credentials, a new Main Menu Component should be created. What happens right now is I don’t know how to delete the Authentication Component, and the Menu Component does get created on top of the Auth Component, but when you maximize the DocumentWindow, the Auth Component is still there in the background, and the new Menu Component doesn’t maximize along with the DocumentWindow. This is because the MainMenu Component is not somehow attached to or a child of the DocumentWindow. Attached is a screen shot showing this and how funny it is.
Any insight greatly appreciated for these questions. I am really lost. I want to know how to replace components easily and have them attached to the same DocumentWindow object.
- How do I delete the AuthComponent within the cpp file that is running it?
- How do I make sure that the new Menu Component is a child of the DocumentWindow object?
Please help. Here is code for creating Menu Component within the cpp file that is running the Auth Component:
if (result == 1) {
// Authentication success
// We probably should delete the AuthComponent but we don’t know how
//fadeOutComponent(1000);
// create menu for user
MainMenuComponent* themenu;
themenu = new MainMenuComponent();
addAndMakeVisible(themenu);
theMainWindow->setName(T("Welcome to LAVA"));
} else {
// Auth failed - Alert Window Box display
AlertWindow::showMessageBox(AlertWindow::NoIcon, T("Authentication failed"),T("Invalid username or password"));
}