0

When the user opens some files, I use the open event in order to make some operations before enabling him to actually open. For that I have a progress dialog.

However, my dialog is always opened behind the open file dialog.

I've added the following code to windowDidLoad of my NSWindowController:

[NSApp activateIgnoringOtherApps:YES];
[[NSApplication sharedApplication] runModalForWindow:self.window];

But it didn't make any impact.

Open dialog: Open dialog

How can I display my dialog in front? Note that my dialog is opened after it and closed before it.

Mugen
  • 8,301
  • 10
  • 62
  • 140
  • You have to modify level property of NSWindow. But the problem is that when you call runmodal/beginsheet, the value gets overwritten. I don't have solution how to get through this – Marek H Oct 29 '15 at 10:17
  • @MarekH what do you mean? I don't have to call runmodal, I'm only doing it trying to fix the problem. What do you suggest regarding the level property? – Mugen Oct 29 '15 at 13:06
  • I am helping you, i don't have solution for you. Windows are drawn in order according to the level property. So you need to set level of your progress windows to value below the openpanel window value – Marek H Oct 29 '15 at 14:30
  • Look here http://stackoverflow.com/questions/32837468/set-level-for-nsalert-in-cocoa/32842404#32842404 – Marek H Oct 29 '15 at 14:35
  • Thanks I'll try it and update – Mugen Oct 30 '15 at 12:14
  • @MarekH it worked, thanks for the help – Mugen Nov 01 '15 at 06:52

1 Answers1

0

With the help from the comments, I found that adding the following line before showing the window resolved the issue:

self.window.level = NSPopUpMenuWindowLevel;
Mugen
  • 8,301
  • 10
  • 62
  • 140