nsopenpanel

NSOpenPanel runModal Crashes?

烂漫一生 提交于 2019-12-22 10:22:31
问题 I'm have a routine based on code found on this forum: + (FSRef)useOpenFileToGetFSRef:(NSString **)fileName requiredFileType: (NSString*) requiredFileType { FSRef fileFSRef; NSArray* fileTypes = [[NSArray alloc] initWithObjects:requiredFileType, nil]; //http://stackoverflow.com/questions/11815784/objective-c-nsopenpanel-get-filename NSOpenPanel* openDlg = [NSOpenPanel openPanel]; [openDlg setFloatingPanel:YES]; [openDlg setCanChooseDirectories:NO]; [openDlg setCanChooseFiles:YES]; [openDlg

NSOpenPanel in Swift . How to open?

痞子三分冷 提交于 2019-12-20 17:28:39
问题 I have this Objective-C Code : - (IBAction)selectFileButtonAction:(id)sender { //create open panel... NSOpenPanel* openPanel = [NSOpenPanel openPanel]; // NSLog(@"Open Panel"); //set restrictions / allowances... [openPanel setAllowsMultipleSelection: NO]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanCreateDirectories:NO]; [openPanel setCanChooseFiles:YES]; //only allow images... [openPanel setAllowedFileTypes:[NSImage imageFileTypes]]; //open panel as sheet on main window...

Cocoa-Applescript NSOpenPanel?

ぐ巨炮叔叔 提交于 2019-12-19 11:39:07
问题 How do I do an NSOpenPanel in Cocoa-Applescript? Are there any good tutorials? I am familiar with Applescript, but not really the Cocoa part. Do I need a nib for the NSOpenPanel? I am making an Automator action. See my previous question. 回答1: Shane Stanley's PDF book AppleScriptObjC Explored is the one to get for AppleScriptObjC tutorials - pretty much all of the examples from Apple are in the existing ObjC documentation and would need to be converted. There is an Automator path pop-up button

NSSavePannel - how to restrict user to only save one one set directory?

空扰寡人 提交于 2019-12-13 03:02:39
问题 User has to save a file, but I only want them saving the file in one folder. How to do this? I have already tried implementing the delegate and forcefully setting back the directory if it is different. This does not work. The user is still able to select other folders when the save panel opens extension Project: NSOpenSavePanelDelegate { func panel(_ sender: Any, didChangeToDirectoryURL url: URL?) { if url != testsFolder { (sender as! NSSavePanel).directoryURL = testsFolder } } func panel(_

How to access Media section (Photo & Movies) directly from NSOpenPanel in Mac OS X application?

拈花ヽ惹草 提交于 2019-12-12 05:38:59
问题 I already refered this link iMedia Now i am using NSOpenPanel to open iPhoto library folder. Here is the code which allow to open. int i = 0; NSOpenPanel* openDlg = [NSOpenPanel openPanel]; [openDlg setCanChooseFiles:YES]; [openDlg setAllowedFileTypes:[NSArray arrayWithObjects:@"public.image",@"public.video",nil]]; [openDlg setAllowsMultipleSelection:TRUE]; [openDlg setAllowsOtherFileTypes:NO]; if ( [openDlg runModal] == NSOKButton ) { NSArray *files = [openDlg URLs]; for( i = 0; i < [files

NSOpenPanel related memory questions

Deadly 提交于 2019-12-11 15:56:30
问题 Below is my code: NSOpenPanel *openDlg = [NSOpenPanel openPanel]; [openDlg setCanChooseFiles:YES]; [openDlg setAllowedFileTypes:[NSArray arrayWithObjects:@"pdf", nil]]; if([openDlg runModal] == NSOKButton) { ... } Before I call runModal the memory used was 30MB, but after calling it, the memory used seemed to be 70MB, and when I scroll up and down, the used memory is increasing. Can anyone tell me the reason? Is it kind of memory leak? 来源: https://stackoverflow.com/questions/16009317

How do I make my program wait for NSOpenPanel to close?

吃可爱长大的小学妹 提交于 2019-12-11 03:26:19
问题 Like the title states, I need to make my program wait until my NSOpenPanel closes. I have the panel open in windowControllerWillLoadNib so that it happens before my document window opens. But what happens is that, it just loads both windows without waiting for the panel to close. How can I make it wait until the open panel is closed and completely finished? 回答1: use runModal method. Code example: int result; NSOpenPanel *oPanel = [NSOpenPanel openPanel]; result = [oPanel runModalForDirectory

NSOpenPanel setAllowedFileTypes

纵饮孤独 提交于 2019-12-10 01:50:33
问题 I have a NSOpenPanel. But I want to make it PDF-files selectable only. I'm looking for something like that: // NOT WORKING NSOpenPanel *panel; panel = [NSOpenPanel openPanel]; [panel setFloatingPanel:YES]; [panel setCanChooseDirectories:YES]; [panel setCanChooseFiles:YES]; [panel setAllowsMultipleSelection:YES]; [panel setAllowedFileTypes:[NSArray arrayWithObject:@"pdf"]]; int i = [panel runModalForTypes:nil]; if(i == NSOKButton){ return [panel filenames]; } I hope someboby has a solution.

Resize and Save NSImage?

梦想与她 提交于 2019-12-09 06:27:27
问题 I have an NSImageView which I get an image for from an NSOpenPanel. That works great. Now, how can I take that NSImage, half its size and save it as the same format in the same directory as the original as well? If you can help at all with anything I'd appreciate it, thanks. 回答1: Check the ImageCrop sample project from Matt Gemmell: http://mattgemmell.com/source/ Nice example how to resize / crop images. Finally you can use something like this to save the result (dirty sample): // Write to

NSOpenPanel crashes when debugging with Xcode 4.5.1

孤人 提交于 2019-12-07 18:50:15
问题 I have a document-based application. Since upgrading to XCode 4.5.1 (from 4.4) NSOpenPanel crashes when I debug the application from Xcode. It does not crash when I start the program directly. I use NSOpenPanel on two occasions: When the user selects "Open" from the "File" menu (since it is a document-based application, none of my own code is involved) and for importing some data into my document (so it gets called by my own code). NSOpenPanel crashes on both occasions (the dialog opens, but