Extending a save panel
Extending a save panel
- Subject: Extending a save panel
- From: Matt Mashyna <email@hidden>
- Date: Thu, 16 Dec 2004 17:00:59 -0500
I want to add popup button to my save panel so that I can save file in different formats. When the document is created I don't know what format the user will want to save it in. So, I want to allow them to choose from the pop up.
So, I added an NSPopUpButton to the panel using prepareSavePanel. I thought I could use setTarget and SetAction to catch the changes in the pop up. It builds OK and the pop up is there but when I used SetAction the pop up is disabled, otherwise it looks OK.
I think maybe I'm going about this all wrong. Can someone tell me the right way to do it ? Here some snippets from MyDocument.m:
- (id)sender
{
int val = [sender intValue];
} // setDSCFileMode
- (BOOL)prepareSavePanel:(NSSavePanel *)savePanel
{
NSPopUpButton* saveModeButton; // mode to save file in (Mac or Windows)
NSRect bRect = {0, 0, 130, 30};
saveModeButton = [[NSPopUpButton alloc] initWithFrame:bRect pullsDown:NO];
[saveModeButton addItemWithTitle:@"Mac OS"];
[saveModeButton addItemWithTitle:@"Windows"];
[saveModeButton setTarget: self];
SEL tellMeAboutIt = @selector(setDSCFileMode);
[saveModeButton setAction: tellMeAboutIt];
[savePanel setAccessoryView: saveModeButton];
return YES;
} // prepareSavePanel
Matt Mashyna
The Frodis Co.
www.frodis.com
_______________________________________________
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