Question

I am using NSSplitview of which upper half is NSTableView and lower is NSTabview with 2 items. Each NStabViewItem has a NSTextview. All are defined in nib file.

Now on selection of row of NSTableview, I load content of file and set it on NSTextview of NSTabViewItem. so NSTabview items I load depending on what rows of NSTableView is selected.

However I observe appreciable delay of 5-6 seconds to see the text visible on NSTextview of NSTabViewItem of NSTabView.But if I hover the mouse in the NSTabView region the content of NSTextview of NSTabViewItem of NSTabview is shown immediately. Can anybody guide me what is the issue?

I am only using NSTableView delegate, Not tabview delegate. I just load the content in respective NSTextView of each NSTabViewItem of tabview.

Code Snippet:

 - (void)tableViewSelectionDidChange:(NSNotification *)notification
    {
        if ([mTableView selectedRow] != -1)
        {
            selectedNode = [mLogContainer objectAtIndex:[mTableView selectedRow]];
            [self manageTabView:[selectedNode logfile]];

        }
    }

-(void) manageTabView:(NSString*) fname
{
    [self loadTextView:mDetailView withFilePath:fname];
    NSString* summaryFile = [NSString stringWithFormat:@"%@.summary",fname];
    [self loadTextView:mSummaryView withFilePath:summaryFile];
    [mTabView selectTabViewItemAtIndex:0];

}


-(void) setContent:(NSString*) content forView:(NSTextView*) textView
{
    NSString* fileContent = [[NSString alloc] init];    
    [fileContent stringWithContentsOfFile:content 
          encoding:NSUTF8StringEncoding error:nil];
    NSTextStorage *textStorage = [textView textStorage];
    [textStorage beginEditing];
    [[textStorage mutableString] setString:fileContent];
    [textStorage endEditing];
    [textView setNeedsDisplay:YES];
} 
Was it helpful?

Solution

How much ever stupid it may sound, but the problem of this weird behavior was that the NStextview in the nib frame was a bit bigger than the NSTabviewItem view. Not sure what is the reason for this behavior but when I re-sized the NSTextView .. Everything is working fine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top