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 6341729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T20:05:45+00:00 2026-05-24T20:05:45+00:00

I have an odd issue cropping up with an NSOutlineView. The view is essentially

  • 0

I have an odd issue cropping up with an NSOutlineView. The view is essentially a list of apps with associated files as children. I populate the view by hand in it’s data source and all of that works fine. What I now want to do is have a button to remove an item. In order to do it I implemented a method, removeAppOrFile, like so:

- (IBAction)removeAppOrFile:(id)sender
{
    NSInteger selectedRow = [myView selectedRow];
    if (selectedRow == -1) //ie. nothing's selected
    {
        return;
    }  
    NSTableColumn *col = [myView tableColumnWithIdentifier:@"Column 1"];
    NSCell *cell = [col dataCellForRow:selectedRow];
    NSString *item = [cell stringValue];
    NSLog(@"The row is: %ld\nThe column is: %@\nThe cell is: %@\nThe selected item is: %@",selectedRow, col, cell, item); // For testing purposes
}

myView is an IBOutlet connected to my NSOutlineView.
If I select a different row and click the button the value for selectedRow will change properly, but the NSCell object never changes, and what should be it’s value (ie. NSString item) always shows that of the last visible item (ie. if there’s an item with children as the last item NSString item will be the parent if it’s not expanded, or the last child if it is expanded).

The weird thing is that I use basically the same code elsewhere for a doubleAction on an NSOutlineView and it works perfectly. In that case, the code is as below:

- (void)editedAppOrFile:(id)sender 
{
    NSInteger rowNumber = [sender clickedRow];
    NSTableColumn *col = [sender tableColumnWithIdentifier:@"Column 1"];
    NSCell *cell = [col dataCellForRow:rowNumber];
    NSString *item = [cell stringValue];
    NSLog(@"The row is: %ld\nThe column is: %@\nThe cell is: %@\nThe selected item is: %@",selectedRow, col, cell, item); // For testing purposes
}

In this case sender is the outlineView. item & cell change with rowNumber change.

Any idea as to why it’s not working in the first example?

  • 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-24T20:05:46+00:00Added an answer on May 24, 2026 at 8:05 pm

    There are a few issues with your approach.

    1. You’re getting the data cell, not the -preparedCellAtColumn:row:, so you have no guarantees about what its internal object value will be.
    2. You can ask the outline view directly for -itemAtRow:.
    3. If you’re trying to remove (in the first case) or edit (the second case), you really only need to modify your data source and then note number of rows changed (first case) or reload data for row (second case).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an odd linq subquery issue. Given the following data structure: Parents Children
I have an odd issue. I have client that wants a sharepoint list what
I have an odd issue while using FlashCS4. I have a textfield that, when
I have a very odd issue. When I execute a specific database stored procedure
I am learning JQuery, and I have ran into an odd issue. I made
This is very odd. I have never had this issue with ShowDialog in C#.
I have an odd alignment issue where an extra space is being added. Here
I have a bit of an odd issue. I have a projects controller where
I have a little bit of an odd issue. When I run this SQL:
I have a really odd issue with WMI that I'm running into on a

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.