Hi,
I have a simple controller which should display a modal panel, decoded
from a nib/gorm interface file (for reference GetNameController.m in FTP
in GAP).
the controller has this method:
-(NSInteger)runAsModal
{
NSInteger result;
[panel makeFirstResponder: textField];
result = [NSApp runModalForWindow: panel];
return result;
}
and each ok/cancel button does:
-(IBAction)cancelPressed:(id)sender
{
[panel close];
[NSApp stopModalWithCode: NSAlertAlternateReturn];
}
looks simple and it should work, doesn't it? Well, Almost.
On the mac, the following may happen: the user hits the "close" button
of the window or hits "esc". In that case, the panel disappears, but the
app is still in the modal run loop (all interfaces disabled). The only
thing I can do is terminate the application.
I guess instead that I should be able to trap that closure and return
either NSAlertAlternateReturn or NSAlertErrorReturn. What do you think?
and how? I tried to implement "performClose" but it doesn't get called
in the delegate.
Thus I think my code is somehow incorrect, however on GNUstep I notice
1) it works? I can close the panel without problems
2) esc doesn't close the panel, even if the Apple doc says it should.
"If a panel is the key window and has a close button, it closes itself
when the user presses the Escape key."
Riccardo
_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep