• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Save dialog question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Save dialog question


  • Subject: Re: Save dialog question
  • From: Stephane Sudre <email@hidden>
  • Date: Thu, 21 Sep 2006 17:27:56 +0200


On 21 sept. 06, at 16:47, Matt Mashyna wrote:

I have an app that works on documents. Now, we have hit upon the idea that it
would be a really great feature to "Save" or "Save As" these documents not to
a file system but to a URL or some kind of net service.


I think the user would choose a document type from the popup at the bottom. If
the user chose to make it a "Remote" document we would only want the user to
be able to put in a name and make the file system pane disappear or at least
disable it.


Is there a way to disable views on the NSSavePanel ?

Some code that needs to improved (for the switchType mechanism) that could answer your question:


In the MainMenu.nib, I have:

- an Instance of MainController

- a NSView with a NSPopUpButton

- a NSWindow with a NSButton

o the NSButton target and action are : MainController and showPAnel:

o IBwindow_ is set to the NSWindow

o IBsubView_ is set to the NSView

o the NSPopUpButton target and action are: MainController and switchType:

--------8<----------8<----------8<----------8<----------8<--------- -8<----------8<----------

#import <Cocoa/Cocoa.h>

@interface MainController : NSObject
{
	IBOutlet id IBwindow_;
	IBOutlet id IBsubView_;
}

- (IBAction)showPAnel:(id)sender;

- (IBAction)switchType:(id)sender;

@end

--------8<----------8<----------8<----------8<----------8<--------- -8<----------8<----------

#import "MainController.h"

@interface NSSavePanel (toto)

- (NSView *) hideButton;

@end

@implementation NSSavePanel (toto)

- (NSView *) hideButton
{
	return _expansionButton;
}

@end

@implementation MainController

- (IBAction)showPAnel:(id)sender
{

NSSavePanel * tSavePanel;

tSavePanel=[NSSavePanel savePanel];

[tSavePanel setAccessoryView:IBsubView_];

[tSavePanel beginSheetForDirectory:nil file:@"toto" modalForWindow:IBwindow_ modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
}


- (void)savePanelDidEnd:(NSSavePanel *)sheet returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
NSLog(@"%@",[sheet filename]);
}


- (IBAction)switchType:(id)sender
{

	static NSRect tExpansionButtonRect;

	NSView * tView;
	NSSavePanel * tPanel;

	tPanel=[sender window];

	tView=[tPanel hideButton];

	if ([tPanel isExpanded]==YES)
	{
		[tPanel _setIsExpanded:NO];

		tExpansionButtonRect=[tView frame];

		[tView setFrame:NSZeroRect];

		[[tView superview] setNeedsDisplayInRect:tExpansionButtonRect];
	}
	else
	{
		[tView setFrame:tExpansionButtonRect];

		[tView setNeedsDisplay:YES];

		[tPanel _setIsExpanded:YES];
	}
}

@end

--------8<----------8<----------8<----------8<----------8<--------- -8<----------8<----------

Yes, it's dirty, but it works on 10.3 and 10.4.

_______________________________________________
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


References: 
 >Save dialog question (From: "Matt Mashyna" <email@hidden>)

  • Prev by Date: Re: pid vs. Process Serial Number
  • Next by Date: Re: pid vs. Process Serial Number
  • Previous by thread: Re: Save dialog question
  • Next by thread: Re: Save dialog question
  • Index(es):
    • Date
    • Thread