FROM : Matt Mashyna
DATE : Thu Dec 16 23:00:59 2004
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:
- (void)setDSCFileMode:(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
DATE : Thu Dec 16 23:00:59 2004
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:
- (void)setDSCFileMode:(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
| Related mails | Author | Date |
|---|---|---|
| Matt Mashyna | Dec 16, 23:00 | |
| Shaun Wexler | Dec 16, 23:26 | |
| Matt Mashyna | Dec 17, 00:56 |






Cocoa mail archive

