AlertWindow on iPhone not accepting input

I have an AlertWindow with a few components in it.

The alert opens centered in landscape mode on the iPhone.

However the alert ignores all input in the upper right portion of the alert.

Even clicks to drag the window in the right most portion of the titlebar are ignored.

If you move the alert the dead area changes size.

Its like the origin is messed up or something.

Drawing is fine and interestingly iPad is also fine.

This is only on iPhone.

Ideas?

I'm struggling to reproduce this, could you provided a minimal example that shows your problem?

And as always, make sure you're on the tip!

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();
}

Thanks! I've managed to reproduce your issue, and it's a bug in JUCE. Notice that the area that you cannot drag in is where the PopupMenu was.

For some reason, when this area is clicked, we're not getting the touch event from iOS. We'll look into this!

Has there been any progress on this?

We are still looking at this bug. It's very strange: we release the native window used to show the Popup menu and we can see that the retain count goes to zero and the windoow disappears. However, when we issue


[[[UIApplication sharedApplication] keyWindow] recursiveDescription]

to list all the windows in the debugger, the Popup menu is still there and seems to still receive touch events. Strange bug...