Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584001
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T18:49:03+00:00 2026-05-30T18:49:03+00:00

I am new to cocoa programming, Using the below code I want to show

  • 0

I am new to cocoa programming, Using the below code I want to show the selected file names in window. How can I do that?

- (IBAction)selectFile:(id)sender {

    int i; // Loop counter.

    // Create the File Open Dialog class.
    NSOpenPanel* openDlg = [NSOpenPanel openPanel];

    NSArray *fileTypes = [NSArray arrayWithObjects:@"wmv", @"3gp", @"mp4", @"avi", @"mp3", @"mma", @"wav", nil];

    // Enable the selection of files in the dialog.
    [openDlg setCanChooseFiles:YES];

    //Enable multiple selection of files
    [openDlg setAllowsMultipleSelection:YES];

    // Enable the selection of directories in the dialog.
    [openDlg setCanChooseDirectories:YES];

    // Display the dialog.  If the OK button was pressed,
    // process the files.
    if ( [openDlg runModalForDirectory:nil file:nil types:fileTypes] == NSOKButton )
    {
        // Get an array containing the full filenames of all
        // files and directories selected.
        NSArray* files = [openDlg filenames];

        // Loop through all the files and process them.
        for( i = 0; i < [files count]; i++ )
        {
            NSString* fileName = [files objectAtIndex:i];

            NSLog(@"filename::: %@", fileName);

            // Do something with the filename.
        }
    }
}

In NSLog I am getting the names, what I want is to show the names on window too, to show the user that these files are selected.

Which view can be used? What is the way to achieve this?

Thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T18:49:05+00:00Added an answer on May 30, 2026 at 6:49 pm

    Use an NSTextView or an NSTextField.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to Cocoa/macOS programming. I just found out that NSUserDefaults can be used
I am quite new to Cocoa and to iPhone programming. I am using the
Even the standard blank-window Cocoa app that gets built when you make a new
I'm new to Cocoa development - I want to display an aribitrary number of
I'm very new to Cocoa for MacOSX, but I can't help but feel like
I'm new to Objective-C and Cocoa. I've read that NSInteger and NSNumber are preferred
I am relatively new to Cocoa programming, and some aspects of memory managing are
I'm new to Cocoa and xCode, but not programming though. I have created some
I'm rather new to programming in Cocoa, but I've been working on learning the
I'm new to Obj-C/Cocoa programming, and I'm having an issue trying to dynamically add

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.