Nsopenpanel use (Use of MAC Open Folder dialog box)
1. Get multiple selections of files
2. Specify the file type
-(nsstring *) Get_fullpath
{
nsopenpanel *panel = [ nsopenpanel< Span style= "COLOR: #000000" > openpanel ];
nsarray * filetypes = [[ nsarray alloc ] initwithobjects @ "txt" , @ "Doc" &NBSP; nil ];
[panel setmessage:@ "Select a file"];
[Panel setprompt:@ "OK"];
[panel setcanchoosedirectories:NO];
[panel setcancreatedirectories:YES];
[panel setcanchoosefiles:YES];
[panel setallowsmultipleselection:YES];
[Panel setallowedfiletypes: filetypes];
nsstring *path_all=@ "";
Nsarray *select_files;
Nsinteger result = [panel runmodal];
m_lb1. StringValue =@ "";
if (result = =Nsfilehandlingpanelokbutton)
{
Select_files = [panel filenames];
for (int i=0; i<select_files. Count; i++)
{
path_all= [Select_files objectatindex: i];
m_lb1. StringValue = [m_lb1. StringValuestringbyappendingstring:p Ath_all];
m_lb1. StringValue = [m_lb1. StringValuestringbyappendingstring:@ "\ n"];
NSLog (Path_all);
}
}
return @"";
}
@end
The above is passed on Xcode 4.6!
Nsopenpanel use (Use of MAC Open Folder dialog box)