NSSegmentedControl, Modal Window problems and Sheets
NSSegmentedControl, Modal Window problems and Sheets
- Subject: NSSegmentedControl, Modal Window problems and Sheets
- From: Andrew Skinner <email@hidden>
- Date: Thu, 2 Dec 2004 15:15:20 +0000
I'm a bit of a newbie and I'm hoping that someone may be able to help
me with this interface problem.
I have created a NSSegmentedControl in a view subclass as a single
section set with a graphic to represent a button.
When the button is pressed I want to show a sheet. However when i click
the segment to launch the sheet I get the error:
2004-12-02 12:21:17.807 teleport[14767] *** Assertion failure in
-[NSApplication
_commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:
didEndSelector:contextInfo:], AppKit.subproj/NSApplication.m:2763
2004-12-02 12:21:17.811 teleport[14767] Modal session requires modal
window
I have read a stack of posts relating to this in the list archives and
have searched Google as far as I can to no avail.
Here are the details:
1. Everything is running in the main Application window.
2. I am calling the sheet with this code:
[segControl setAction:@selector(openSheet:)];
and the function called is:
- (IBAction)openSheet:(id)sender
{
[NSApp beginSheet: theSheet
modalForWindow: mainWindow
modalDelegate: self
didEndSelector: @selector(sheetDidEnd:
returnCode: contextInfo:)
contextInfo: nil];
}
3. Main window is an outlet connected to the main window in IB, I have
tried setting the modalForWindow attribute to all sorts but nothing
seems to work.
4. All of this code is contained in the view subclass that I have
created to display the segmented control.
5. I have instantiated the view class in IB and made the connections.
6. if I use the same code with a standard button everything works fine.
7. I tried a standard alert panel and it displys but is not connected
to the window so i am sure i am referencing the main window
incorrectly.
8. I know that the action is being called correctly from the
NSSegmentedControl as I get a readout from NSLog tests
It's driving me mad so if anyone can help i'd be eternally grateful.
Fingers crossed,
a
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden