Positioning FileChooserDialogBox when using multiple monitors




I’m trying to position a FileChooserDialogBox to follow the main window in a standalone application, across a system with multiple monitors. I’m using the approach sketched in FileChooserDialogBox.h.

I can get the positioning for the FileChooserDialogBox object fine by calling .centerWithDefaultSize(getTopLevelComponent()) on it. Since I have multiple monitors, the x-position calculated by .centerWithDefaultSize() becomes negative if I move the application to a monitor to the left of my main monitor. However, showing the FileChooserDialogBox object by using .showAt() with the objects position and dimensions doesn’t work as negative positional coordinates are ignored and the FileChooserDialogBox is defaulted to show in the center of my main monitor.

The approach above works fine as long as I only use one monitor.

Is there any reason why this restriction (not allowing negative positional coordinates) is imposed in the FileChooserDialogBox.showAt()?

And, more importantly, what solution would you suggest to get the positioning working on a system with multiple monitors?

PS: I’m on WIN10/OSX10.13.3 and JUCE 5.2.0