Recent changes RSS feed

 

COCOA: Aprire la finestra di caricamento/salvataggio file

Si può utilizzare la classe NSOpenPanel nel seguente modo:

       [filesList removeAllObjects];  //filesList è un NSArray
 
          NSOpenPanel *oPanel = [NSOpenPanel openPanel];
          [oPanel setFrame: NSMakeRect(0, 0, 600, 400) display: NO];
          [oPanel setTitle:@"Open ext files"];
          [oPanel setPrompt:@"OK"];
          [oPanel setCanChooseDirectories:NO];
          [oPanel setCanChooseFiles:YES];
          [oPanel setAllowsMultipleSelection:YES];
          [oPanel setResolvesAliases:NO];
 
       NSArray * filesType = [NSArray arrayWithObjects:@"ext"];   
       int result = [oPanel runModalForTypes: filesType];
 
          if (result == NSOKButton) {
             NSArray *filesToOpen = [oPanel filenames];
             for(int k = 0;k<[filesToOpen count];k++){
                NSString *aFile = [filesToOpen objectAtIndex:k];
                [filesList addObject:aFile];
             }
          }
    }





HOMEINDIETRO
AudioVideoGraficaInternetMasterizzazioneSicurezzaUtilityMac
FormulariMiniguideRisorse

 
guide_osx_cocoa_finestra_apri_file.txt · Ultima modifica: 2009/11/22 09:58 (modifica esterna)

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki