0
votes

I have NSWindow with custom NSView. This custom NSView override performDragOperation method. Drag-and-drop operations works good. But when I create and show NSAlert as modal window I need block drag-and-drop, method, performDragOperation shouldn't be called.

NSAlert *alert = [[NSAlert alloc]init];
[alert addButtonWithTitle:@"Excellent"];
[alert setMessageText:@"This is your message."];
[alert runModal];

One of possible solution is add code that verify if dialog is shown to performDragOperation method. But how to detect if NSAlert is shown. For example for sheet I can use:

if([window attachedSheet]) {
   ...
}

But how do this for

[alert runModal];
1
NSApplication has a property modalWindow.Willeke
Thanks Willeke. It is exactly what I need.Victor.V

1 Answers

0
votes

According to Willeke comments, to detect if some Alert is running can be used next code:

if([NSApp modalWindow]) { 
  ...
}