JoaoFCA
JoaoFCA

Reputation: 41

NSWindow ignore mouse/keyboard events

At this time I'm developing a Cocoa application, that is formed by a main NSWindowController, where all the application data is showed and some others NSWindowControllers that will appear, like a formulary, when the user needs to edit or add more data to the main NSWindowController window.

My problem is that when i need to add or edit data in these formularies, the main NSWindowController can't have any kind of user interaction, to prevent any change in the main NSWindowController's displayed information.

I've already tried -(void)setIgnoresMouseEvents:(BOOL)flag but this solution makes the main NSWindowController completely transparent to interaction, making any accidental click, interact with any window bellow thus hiding the application.

Does anyone knows of a better solution?

Upvotes: 2

Views: 1615

Answers (1)

JoaoFCA
JoaoFCA

Reputation: 41

I finally found what i was looking for:

[NSApp runModalForWindow:(NSWindow *)aWindow];

In this way, i can prevent any interaction with the mother Window until i close the child windows and do:

[NSApp stopModal]; 

so that it becomes active again.

Upvotes: 2

Related Questions