Modal Session
Hello, I'm new here.
I would like to open a modal window when I press the mouse button in a view, not when I press a button. How can i do it?
when I do this:
-(IBAction)showMaterialSheet:(id)sender{
[NSApp beginSheet:cargaSheet
modalForWindow:[inPinta window]
modalDelegate:nil
didEndSelector:NULL
contextInfo:NULL];
all it's ok.
but when I wont to do this in:
-(void)mouseDown:(NSEvent *)theEvent{
if (pintarRectangulo) {
if (inicio) {
path=[[NSBezierPath alloc] init];
puntoInicial=[theEvent locationInWindow];
[path moveToPoint:[theEvent locationInWindow]];
inicio=!inicio;
[NSApp beginSheet:cargaSheet
modalForWindow:[inPinta window]
modalDelegate:nil
didEndSelector:NULL
contextInfo:NULL];
}
[self setNeedsDisplay:YES];
}
I have this error:
2009-12-24 07:17:56.287 Secciones[2484:a0f] *** Assertion failure in -[NSApplication _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:], /SourceCache/AppKit/AppKit-1038.25/AppKit.subproj/NSApplication.m:3100
2009-12-24 07:17:56.288 Secciones[2484:a0f] Modal session requires modal window
thanks,
Joaquín