Here is a simple example that demonstrates the problem.
The issue seems to be with PopupMenu rather than AlertWindow.
You can run this on an ios simulator to see the problem.
Thanks!
Main.cpp
#include "../JuceLibraryCode/JuceHeader.h"
#include "MainComponent.h"
struct MainApplication : public JUCEApplication {
MainApplication() {}
const String getApplicationName() override {return ProjectInfo::projectName;}
const String getApplicationVersion() override {return ProjectInfo::versionString;}
bool moreThanOneInstanceAllowed() override {return true;}
void initialise (const String& commandLine) override {
mainWindow = new MainWindow (getApplicationName());
}
void shutdown() override {mainWindow = nullptr;}
void systemRequestedQuit() override {quit();}
void anotherInstanceStarted (const String& commandLine) override {}
struct MainWindow : public DocumentWindow {
MainWindow(String name)
: DocumentWindow(name, Colours::lightgrey, DocumentWindow::allButtons) {
setResizable(false, false);
setFullScreen(true);
setUsingNativeTitleBar(true);
centreWithSize(getWidth(), getHeight());
Component* mainComponent = new MainComponent();
mainComponent->setBounds(0, 0, getWidth(), getHeight());
setContentOwned(mainComponent, true);
setVisible(true);
}
};
ScopedPointer<MainWindow> mainWindow;
};
START_JUCE_APPLICATION(MainApplication)
MainComponent.h
#include "../JuceLibraryCode/JuceHeader.h"
#include "Titlebar.h"
struct MainComponent : public Component {
Titlebar titlebar;
MainComponent() {
addAndMakeVisible(&titlebar);
}
void paint(Graphics& g) {
g.fillAll(Colour(0xff001F36));
g.setFont(Font(16.0f));
g.setColour(Colours::white);
g.drawText("AlertWindow Test!", getLocalBounds(), Justification::centred, true);
}
void resized() {
titlebar.setBounds(0, 0, getWidth(), 35);
}
};
Titlebar.h
#include "JuceHeader.h"
struct Titlebar : public Component, public ButtonListener {
Titlebar();
~Titlebar() = default;
virtual void paint(Graphics& g) override;
virtual void resized() override;
virtual void buttonClicked(Button* buttonThatWasClicked) override;
void openDialog();
TextButton button;
};
Titlebar.cpp
#include "Titlebar.h"
Titlebar::Titlebar() : button("Menu") {
addAndMakeVisible(&button);
button.addListener(this);
}
void Titlebar::paint (Graphics& g) {
g.fillAll(Colours::white);
}
void Titlebar::resized() {
button.setBounds(getWidth() - 10 - 100, 5, 100, 25);
}
void Titlebar::buttonClicked(Button* buttonThatWasClicked) {
PopupMenu menu;
// Seems the popup menu creates the dead zone in the
// subsequent dialog that matches the area of the
// popup menu. I've made the menu really large here to
// demonstrate. If you comment out the dummy items,
// the dead zone is really small, just clipping the top
// right of the dialog.
menu.addItem(1, "Open Dialog");
//menu.addItem(2, "Really Long Dummy Item 1");
//menu.addItem(3, "Really Long Dummy Item 2");
//menu.addItem(4, "Really Long Dummy Item 3");
//menu.addItem(5, "Really Long Dummy Item 4");
//menu.addItem(6, "Really Long Dummy Item 5");
//menu.addItem(7, "Really Long Dummy Item 6");
//menu.addItem(8, "Really Long Dummy Item 7");
//menu.addItem(9, "Really Long Dummy Item 8");
const int result = menu.show();
if (result == 1)
openDialog();
}
void Titlebar::openDialog() {
AlertWindow w ("AlertWindow test", "", AlertWindow::NoIcon);
const char* options[] = { "option 1", "option 2", "option 3", "option 4", nullptr };
w.addComboBox ("option1", StringArray (options), "some options 1");
w.addComboBox ("option2", StringArray (options), "some options 2");
w.addComboBox ("option3", StringArray (options), "some options 3");
w.addButton ("OK", 1, KeyPress (KeyPress::returnKey, 0, 0));
w.addButton ("Cancel", 0, KeyPress (KeyPress::escapeKey, 0, 0));
w.runModalLoop();
}