Return to Snippet

Revision: 74
at July 5, 2006 09:37 by buscarini


Updated Code
- (IBAction)chooseWhere:(id)sender
{
	
	NSLog(@\"Choosing where\");
	
	// TODO: remove the item
	
	NSOpenPanel *panel = [[NSOpenPanel alloc] init];
	
	[panel setCanChooseDirectories:YES];
	[panel setCanCreateDirectories:YES]; // Added by DustinVoss
	[panel setPrompt:@\"Choose folder\"]; // Should be localized
	[panel setCanChooseFiles:NO];
	
	destinationFolder = [[NSString alloc] init];
	
	[panel beginSheetForDirectory:nil file:destinationFolder
			types:nil modalForWindow:mainWindow 
			modalDelegate:self didEndSelector:@selector(openPanelDidEnd:
														returnCode:
														contextInfo:)
														contextInfo:nil];
	
}



- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode  contextInfo:(void  *)contextInfo{


	if (returnCode==NSOKButton){
		destinationFolder = [sheet filename];
		[destinationTextField setStringValue:destinationFolder];
		NSLog(@\"OK button pressed\");
	}
	
	if (returnCode==NSCancelButton){
		NSLog(@\"Cancel button pressed\");
	}


// stringByAppendingString:@\"Open panel ended\"];
	
	NSLog(destinationFolder);
	
}

Revision: 73
at November 30, -0001 00:00 by buscarini


Initial Code
- (IBAction)chooseWhere:(id)sender
{
	
	NSLog(@\"Choosing where\");
	
	// TODO: remove the item
	
	NSOpenPanel *panel = [[NSOpenPanel alloc] init];
	
	[panel setCanChooseDirectories:YES];
	[panel setCanCreateDirectories:YES]; // Added by DustinVoss
	[panel setPrompt:@\"Choose folder\"]; // Should be localized
	[panel setCanChooseFiles:NO];
	
	destinationFolder = [[NSString alloc] init];
	
	[panel beginSheetForDirectory:nil file:destinationFolder
			types:nil modalForWindow:mainWindow 
			modalDelegate:self didEndSelector:@selector(openPanelDidEnd:
														returnCode:
														contextInfo:)
														contextInfo:nil];
	
}



- (void)openPanelDidEnd:(NSOpenPanel *)sheet returnCode:(int)returnCode  contextInfo:(void  *)contextInfo{


	if (returnCode==NSOKButton){
		destinationFolder = [sheet filename];
		[destinationTextField setStringValue:destinationFolder];
		NSLog(@\"OK button pressed\");
	}
	
	if (returnCode==NSCancelButton){
		NSLog(@\"Cancel button pressed\");
	}


// stringByAppendingString:@\"Open panel ended\"];
	
	NSLog(destinationFolder);
	
}

Initial URL

                                

Initial Description

                                

Initial Title
Panel para abrir ficheros

Initial Tags
textmate, mac

Initial Language
Objective C