Search Results

Search found 31 results on 2 pages for 'nsoutlineview'.

Page 1/2 | 1 2  | Next Page >

  • How to make an NSOutlineView indent multiple columns?

    - by Rinzwind
    What would be the easiest or recommended way for making an NSOutlineView indent multiple columns? By default, it only indents the outline column; and as far as I know there is no built-in support for making it indent other columns. I have an NSOutlineView which shows a comparison between two sets of hierarchical data. For visual appeal, if some item in the outline column is indented, I'd like to indent the item on the same row in another column by the same indentation amount. (There's also a third column which shows the result of comparing the two items, this column should never be indented.) Can this only be achieved by subclassing NSOutlineView? And what would need to be overridden in the subclass? Or is there an easier way to get it to indent multiple columns?

    Read the article

  • Model Object called in NSOutlineView DataSource Method Crashing App

    - by Alec Sloman
    I have a bewildering problem, hoping someone can assist: I have a model object, called Road. Here's the interface. @@@ @interface RoadModel : NSObject { NSString *_id; NSString *roadmapID; NSString *routeID; NSString *title; NSString *description; NSNumber *collapsed; NSNumber *isRoute; NSString *staff; NSNumber *start; NSArray *staffList; NSMutableArray *updates; NSMutableArray *uploads; NSMutableArray *subRoads; } @property (nonatomic, copy) NSString *_id; @property (nonatomic, copy) NSString *roadmapID; @property (nonatomic, copy) NSString *routeID; @property (nonatomic, copy) NSString *title; @property (nonatomic, copy) NSString *description; @property (nonatomic, copy) NSNumber *collapsed; @property (nonatomic, copy) NSNumber *isRoute; @property (nonatomic, copy) NSString *staff; @property (nonatomic, copy) NSNumber *start; @property (nonatomic, copy) NSArray *staffList; @property (nonatomic, copy) NSMutableArray *updates; @property (nonatomic, copy) NSMutableArray *uploads; @property (nonatomic, copy) NSMutableArray *subRoads; - (id)initWithJSONObject:(NSDictionary *)JSONObject; @end This part is fine. To give you some background, I'm translating a bunch of JSON into a proper model object so it's easier to work with. Now, I'm trying to display this in an NSOutlineView. This is where the problem is. In particular, I have created the table and a datasource. - (id)initWithRoads:(NSArray *)roads { if (self = [super init]) root = [[NSMutableArray alloc] initWithArray:roads]; return self; } - (NSInteger)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { if (item == nil) return root.count; return 0; } - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { return NO; } - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item { if (item == nil) item = root; if (item == root) return [root objectAtIndex:index]; return nil; } - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { return [item title]; } In the final datasource method, it attempts to return the "title" string property of the model object, but for some reason crashes each time. I have checked that the method is taking in the correct object (I checked [item class] description], and it is the right object), but for some reason if I call any of the objects accessors the app immediately crashes. This is totally puzzling because in the init method, I can iterate through root (an array of RoadModel objects), and print any of its properties without issue. It is only when I'm trying to access the properties in any of the datasource methods that this occurs. I wonder if there is something memory-wise that is going on behind the scenes and I am not providing for it. If you can shed some light on to this situation, it would be greatly appreciated! Thanks in advance!

    Read the article

  • NSOutlineView not refreshing when objects added to managed object context from NSOperations

    - by John Gallagher
    Background Cocoa app using core data Two processes - daemon and a main UI Daemon constantly writing to a data store UI process reads from same data store NSOutlineView in UI is bound to an NSTreeController which is bound to Application with key path of delegate.interpretedMOC What I want When the UI is activated, the outline view should update with the latest data inserted by the daemon. The Problem Main Thread Approach I fetch all the entities I'm interested in, then iterate over them, doing refreshObject:mergeChanges:YES. This works OK - the items get refreshed correctly. However, this is all running on the main thread, so the UI locks up for 10-20 seconds whilst it refreshes. Fine, so let's move these refreshes to NSOperations that run in the background instead. NSOperation Multithreaded Approach As soon as I move the refreshObject:mergeChanges: call into an NSOperation, the refresh no longer works. When I add logging messages, it's clear that the new objects are loaded in by the NSOperation subclass and refreshed. Not only that, but they are What I've tried I've messed around with this for 2 days solid and tried everything I can think of. Passing objectIDs to the NSOperation to refresh instead of an entity name. Resetting the interpretedMOC at various points - after the data refresh and before the outline view reload. I'd subclassed NSOutlineView. I discarded my subclass and set the view back to being an instance of NSOutlineView, just in case there was any funny goings on here. Added a rearrangeObjects call to the NSTreeController before reloading the NSOutlineView data. Made sure I had set the staleness interval to 0 on all managed object contexts I was using. I've got a feeling this problem is somehow related to caching core data objects in memory. But I've totally exhausted all my ideas on how I get this to work. I'd be eternally grateful of any ideas anyone else has. Code Main Thread Approach // In App Delegate -(void)applicationDidBecomeActive:(NSNotification *)notification { // Delay to allow time for the daemon to save [self performSelector:@selector(refreshTrainingEntriesAndGroups) withObject:nil afterDelay:3]; } -(void)refreshTrainingEntriesAndGroups { NSSet *allTrainingGroups = [[[NSApp delegate] interpretedMOC] fetchAllObjectsForEntityName:kTrainingGroup]; for(JGTrainingGroup *thisTrainingGroup in allTrainingGroups) [interpretedMOC refreshObject:thisTrainingGroup mergeChanges:YES]; NSError *saveError = nil; [interpretedMOC save:&saveError]; [windowController performSelectorOnMainThread:@selector(refreshTrainingView) withObject:nil waitUntilDone:YES]; } // In window controller class -(void)refreshTrainingView { [trainingViewTreeController rearrangeObjects]; // Didn't really expect this to have any effect. And it didn't. [trainingView reloadData]; } NSOperation Multithreaded Approach // In App Delegate -(void)refreshTrainingEntriesAndGroups { JGRefreshEntityOperation *trainingGroupRefresh = [[JGRefreshEntityOperation alloc] initWithEntityName:kTrainingGroup]; NSOperationQueue *refreshQueue = [[NSOperationQueue alloc] init]; [refreshQueue setMaxConcurrentOperationCount:1]; [refreshQueue addOperation:trainingGroupRefresh]; while ([[refreshQueue operations] count] > 0) { [[NSRunLoop currentRunLoop] runUntilDate:[NSDate dateWithTimeIntervalSinceNow:0.05]]; [windowController performSelectorOnMainThread:@selector(refreshTrainingView) withObject:nil waitUntilDone:YES]; } // JGRefreshEntityOperation.m @implementation JGRefreshEntityOperation @synthesize started; @synthesize executing; @synthesize paused; @synthesize finished; -(void)main { [self startOperation]; NSSet *allEntities = [imoc fetchAllObjectsForEntityName:entityName]; for(id thisEntity in allEntities) [imoc refreshObject:thisEntity mergeChanges:YES]; [self finishOperation]; } -(void)startOperation { [self willChangeValueForKey:@"isExecuting"]; [self willChangeValueForKey:@"isStarted"]; [self setStarted:YES]; [self setExecuting:YES]; [self didChangeValueForKey:@"isExecuting"]; [self didChangeValueForKey:@"isStarted"]; imoc = [[NSManagedObjectContext alloc] init]; [imoc setStalenessInterval:0]; [imoc setUndoManager:nil]; [imoc setPersistentStoreCoordinator:[[NSApp delegate] interpretedPSC]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(mergeChanges:) name:NSManagedObjectContextDidSaveNotification object:imoc]; } -(void)finishOperation { saveError = nil; [imoc save:&saveError]; if (saveError) { NSLog(@"Error saving. %@", saveError); } imoc = nil; [self willChangeValueForKey:@"isExecuting"]; [self willChangeValueForKey:@"isFinished"]; [self setExecuting:NO]; [self setFinished:YES]; [self didChangeValueForKey:@"isExecuting"]; [self didChangeValueForKey:@"isFinished"]; } -(void)mergeChanges:(NSNotification *)notification { NSManagedObjectContext *mainContext = [[NSApp delegate] interpretedMOC]; [mainContext performSelectorOnMainThread:@selector(mergeChangesFromContextDidSaveNotification:) withObject:notification waitUntilDone:YES]; } -(id)initWithEntityName:(NSString *)entityName_ { [super init]; [self setStarted:false]; [self setExecuting:false]; [self setPaused:false]; [self setFinished:false]; [NSThread setThreadPriority:0.0]; entityName = entityName_; return self; } @end // JGRefreshEntityOperation.h @interface JGRefreshEntityOperation : NSOperation { NSString *entityName; NSManagedObjectContext *imoc; NSError *saveError; BOOL started; BOOL executing; BOOL paused; BOOL finished; } @property(readwrite, getter=isStarted) BOOL started; @property(readwrite, getter=isPaused) BOOL paused; @property(readwrite, getter=isExecuting) BOOL executing; @property(readwrite, getter=isFinished) BOOL finished; -(void)startOperation; -(void)finishOperation; -(id)initWithEntityName:(NSString *)entityName_; -(void)mergeChanges:(NSNotification *)notification; @end

    Read the article

  • Implementing A Static NSOutlineView

    - by spamguy
    I'm having a hard time scraping together enough snippets of knowledge to implement an NSOutlineView with a static, never-changing structure defined in an NSArray. This link has been great, but it's not helping me grasp submenus. I'm thinking they're just nested NSArrays, but I have no clear idea. Let's say we have an NSArray inside an NSArray, defined as NSArray *subarray = [[NSArray alloc] initWithObjects:@"2.1", @"2.2", @"2.3", @"2.4", @"2.5", nil]; NSArray *ovStructure = [[NSArray alloc] initWithObjects:@"1", subarray, @"3", nil]; The text is defined in outlineView:objectValueForTableColumn:byItem:. - (id)outlineView:(NSOutlineView *)ov objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)ovItem { if ([[[tableColumn headerCell] stringValue] compare:@"Key"] == NSOrderedSame) { // Return the key for this item. First, get the parent array or dictionary. // If the parent is nil, then that must be root, so we'll get the root // dictionary. id parentObject = [ov parentForItem:ovItem] ? [ov parentForItem:ovItem] : ovStructure; if ([parentObject isKindOfClass:[NSArray class]]) { // Arrays don't have keys (usually), so we have to use a name // based on the index of the object. NSLog([NSString stringWithFormat:@"%@", ovItem]); //return [NSString stringWithFormat:@"Item %d", [parentObject indexOfObject:ovItem]]; return (NSString *) [ovStructure objectAtIndex:[ovStructure indexOfObject:ovItem]]; } } else { // Return the value for the key. If this is a string, just return that. if ([ovItem isKindOfClass:[NSString class]]) { return ovItem; } else if ([ovItem isKindOfClass:[NSDictionary class]]) { return [NSString stringWithFormat:@"%d items", [ovItem count]]; } else if ([ovItem isKindOfClass:[NSArray class]]) { return [NSString stringWithFormat:@"%d items", [ovItem count]]; } } return nil; } The result is '1', '(' (expandable), and '3'. NSLog shows the array starting with '(', hence the second item. Expanding it causes a crash due to going 'beyond bounds.' I tried using parentForItem: but couldn't figure out what to compare the result to. What am I missing?

    Read the article

  • Autoselect, focus and highlight a new NSOutlineView row

    - by coneybeare
    This is probably just lack of experience with the NSOutlineView but I can't see a way to do this. I have a NSOutlineView (implemented with the excellent PXSourceList) with an add button that is totally functional in the aspect that I save/write/insert/delete rows correctly. I do not use a NSTreeController, and I don't use bindings. I add the entity using the following code: - (void)addEntity:(NSNotification *)notification { // Create the core data representation, and add it as a child to the parent node UABaseNode *node = [[UAModelController defaultModelController] createBaseNode]; [sourceList reloadData]; for (int i = 0; i < [sourceList numberOfRows]; i++) { if (node == [sourceList itemAtRow:i]) { [sourceList selectRowIndexes:[NSIndexSet indexSetWithIndex:i] byExtendingSelection:NO]; [sourceList editColumn:0 row:i withEvent:nil select:NO]; break; } } } When the add button is pressed, a new row is inserted like this: If I click away, then select the row and press enter to edit it, it now looks like this: My question is: How can I programmatically get the same state (focus, selected, highlighted) the first time, to make the user experience better?

    Read the article

  • Nstableview group style for nsoutlineview

    - by joels
    I like the look of the group rows in the nstableview. In apple mail, the group sections like mailboxes and rss with that style too. Is there an easy way to make a group row or root item in an nsoutlineview to look like that? I think I have to override the willDisplayCell method...

    Read the article

  • Why does [NSOutlineView clickedRow] always return -1?

    - by jxpx777
    I have a fairly pedestrian non-editable NSOutlineView setup. In the bindings for the outline view, I have set the binding to my file's owner (MyDocument FWIW) with a selector of outlineViewWasDoubleClicked The method exists and is called, but when I call -clickedRow it consistently returns -1 rather than the row number of the row that I double clicked to trigger the method. My _outlineView is an IBOutlet and I've verified that it is hooked up correctly by using -selectedRow for the method rather than -clickedRow (I would rather use -clickedRow though because it seems unintuitive for the user to have a row selected, double click another row to do something with it and have the method triggered with the row they had selected.) My best guess right now is that the -clickedRow value is getting cleared out before my method fires, but I don't know where or what might be gobbling it up. Thanks in advance for any help.

    Read the article

  • Expanding all items of a NSOutlineView that loads data from a data source

    - by matei
    First of all I'm new to cocoa development so I suppose I'm probably trying to do this the wrong way, but here goes: I have a NSOutlineView which loads the data from a NSOutlineViewDataSource imnplementation. I want all the items to be expanded after they are loaded, but i can't seem to find an event fired when the data has finished loading, so I can send a [outlineView expandItem:nil expandChildren: YES] to it. I looked into the NSOutlineViewDelegate protocol but I was unable to find a sutable place for this call. What would be the best approach for this problem ?

    Read the article

  • Dynamically populated NSPopUpButtonCell menu in an NSOutlineView

    - by Mo
    I’m working with an NSOutlineView which has two columns. My dataSource supplies the outline view with a tree of items of a custom class which represents file types (that is, you initialise it with a UTI). The first column is the display name of the file type (e.g., “Source code”, “Interface Builder NIB document”, etc.). The second column is an NSPopUpButtonCell which is supposed to allow the user to pick a handler for the given document type (think of Xcode’s “File Types” preference pane, and you’re pretty much there). I can generate an NSMenu for a given item in the tree, populated with options based upon the Launch Services database entries for the UTI, complete with the relevant application icon and and so on. In fact, the menu itself works wonderfully, populated by way of NSPopUpButtonCellWillPopUpNotification. The problem is, try as I might, the cell when the menu isn’t popped up always contains precisely one of two things: either an empty string, or the default text for the cell, the former if the result of -handlerName on the item (the attribute assigned to the column) is non-nil, the latter otherwise. Moreover, I’m manually calling -selectItem: on the NSPopUpButtonCell instance, which just seems Wrong. In contrast, the left-hand column, which is just an NSTextFieldCell, everything just works (although granted, all it’s got to do is read the value from the item and present it). (Disclaimer: I’m fairly new at Cocoa UI stuff; I know Objective-C, and lots of other programming languages, but I’ve not a huge amount of experience of building Mac OS X UIs, so be gentle).

    Read the article

  • NSOutlineView not redrawing

    - by Septih
    Hello, I have an NSOutlineView with checkboxes. I have the checkbox state bound to a node item with the key shouldBeCopied. In the node item I have the getters and setters like so: -(BOOL)shouldBeCopied { if([[self parent] shouldBeCopied]) return YES; return shouldBeCopied; } -(void)setShouldBeCopied:(BOOL)value { shouldBeCopied = value; if(value && [[self children] count] > 0) [[self delegate] reloadData]; } The idea here is that if the parent is checked, so should the children. The problem I'm having is that when I check the parent, it does not update that view of the children if they are already expanded. I can understand that it should not be updated by the bindings because i'm not actually changing the value. But should reloadData not cause the bindings to re-get the value, thus calling -shouldBeCopied for the children? I have tried a few other things such as -setNeedsDisplay and -reloadItem:nil reloadChildren:YES but none work. I've noticed that the display gets refreshed when I swap to xcode and then back again and that's all I want, so how do I get it to behave that way?

    Read the article

  • Cocoa NSOutlineView and Drag-and-Drop

    - by bobthecoder
    I recently started another thread without an account, so I'm reposting the question here with an account so I can edit current links to the program so other users can follow this. I have also updated the code below. Here is my original question: I read the other post here on Outlineviews and DND, but I can't get my program to work. At the bottom of this post is a link to a zip of my project. Its very basic with only an outlineview and button. I want it to receive text files being dropped on it, but something is wrong with my code or connections. I tried following Apple's example code of their NSOutline Drag and Drop, but I'm missing something. 1 difference is my program is a document based program and their example isn't. I set the File's Owner to receive delegate actions, since that's where my code to handle drag and drop is, as well as a button action. Its probably a simple mistake, so could someone please look at it and tell me what I'm doing wrong? Here is a link to the file: http://dl.dropbox.com/u/7195844/OutlineDragDrop1.zip

    Read the article

  • NSOutlineView with Drag and Drop

    - by bob
    I read the other post here on Outlineviews and DND, but I can't get my program to work. At the bottom of this post is a link to a zip of my project. Its very basic with only an outlineview and button. I want it to receive text files being dropped on it, but something is wrong with my code or connections. I tried following Apple's example code of their NSOutline Drag and Drop, but I'm missing something. 1 difference is my program is a document based program and their example isn't. I set the File's Owner to receive delegate actions, since that's where my code to handle drag and drop is, as well as a button action. Its probably a simple mistake, so could someone please look at it and tell me what I'm doing wrong? Here is a link to the file: http://www.4shared.com/file/or1A7aHk/OutlineDragDrop.html

    Read the article

  • NSOutlineview - strange behavior after reloading data

    - by matei
    I have a NSOutlineView which loads data from a data source. The table is displayed in a panel. The items shown in the table are items which belong to an object (the relation is one-to many between the object and the items). I have a list of objects in a combo box (in fact a NSPopupButton), and when I select another object in the combo box, I want it's items to be shown in the table (the NSOutlineView). I managed to do all this , however when I select another object from the combo box, not all of it's items are displayed. I have put some logging messages in the data source and it seems that there are some items that are being returned from the data source , but are not shown in the table (and are not queried for children). Now the strange part is that when I click the main window (as I said, all that I described here is in a NSPanel loaded on top of the window) , all the data is displayed correctly. It seems as if clicking the main window triggers something in the NSOutlineView that makes it display the missing items, but I can't tell what it is.

    Read the article

  • Cocoa NSOutlineView bug - [NSCFTimer copyWithZone:]: unrecognized selector sent to instance

    - by Circle
    I'm using an NSOutlineView with the function - (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item defined so it gives the group row GUI look. When I add a root item, it works fine. When I add an item to root's child array and expand it, it works fine. If I contract the item though, the following error is logged: [NSCFTimer copyWithZone:]: unrecognized selector sent to instance I also get an EXC_BAD_ACCESS error if the app window is deactivated by switching to another app. I used the debugger to try to find where I might have made an error in one of my functions, but the stack trace only shows functions I did not create (RunCurrentEventLoopInMode, CFRunLoopRunSpecific, handleWindowNeedsDisplay, etc.) Does anyone have any idea where my error(s) might be?

    Read the article

  • Adding view to NSOutlineView

    - by Felix
    Hi All, I need to add a view to NSOutlineView. This view contains some text field and button, while expanding the outlineview should show this view. Please let me know how to add the view the NSOutliveView. Thanks, Felix.

    Read the article

  • How to find NSOutlineView row index when using NSTreeController

    - by velocityb0y
    I'm using an NSTreeController to manage nodes for an NSOutlineView. When the user adds a new item, I create a new object and insert it: EntityViewEntityNode *newNode = [EntityViewEntityNode nodeWithName:@"New entity" entity:newObject]; // Insert at end of group // NSIndexPath *insertAt = [pathOfGroupNode indexPathByAddingIndex:[selected.children count]]; [entityCollectionTreeController insertObject:newNode atArrangedObjectIndexPath:insertAt]; Now I'd like to open the table column for edit so the user can name the new item. This seems logical: NSInteger row = [entityCollectionOutlineView rowForItem:newNode]; [entityCollectionOutlineView editColumn:0 row:row withEvent:nil select:YES]; However, row is always -1 indicating the object isn't found. Poking around reveals that the tree controller is not actually putting my objects directly in the tree, but is wrapping them in a node object of its own. Anyone have insight into how I would go about getting a row index relative to the outline view, so I can do this (without, hopefully, enumerating everything in the outline view and figuring out the mapping back to my node?)

    Read the article

  • NSOutlineView/NSTreeController - calculate sum of column

    - by matei
    I have a NSOutlineView bound to a NSTreeController. My data items are a custom class , let's call them "Row", and suppose a Row contains a "name" and a numeric field called "number" . All these "Rows" are found in let's say a "RowContainer" which has a "rows" mutable array holding the parent (level 0) rows. Each row also has a "children" NSMutableArray member which holds it's children. I have this working, and I want to display under the outlineview a textfield with the sum of all the "number" values of the rows. I bound this textfield to a "total" property of the "RowContainer". Now the problem is how or from where to trigger the recalculation of the "total" property, since this involves a recursive walk on the tree of rows, and I always get a "Collection was mutated while being enumerated" error. I've tried making a method "recalculateTotal", and calling it from the "setNumber" method of the "Row" class , but same error occurs. If I put the recalculation logic in the "total" getter, I can't trigger it to do the math. I'm sure the solution is simple but I can't see it

    Read the article

  • How do I set the default selection for NSTreeController at startup?

    - by John Gallagher
    The Background I've built a source list (similar to iTunes et al.) in my Cocoa app. I've got an NSOutlineView, with Value column bound to arrangedObjects.name key path of an NSTreeController. The NSTreeController accesses JGSourceListNode entities in a Core Data store. I have three subclasses of JGSourceListNode - JGProjectNode, JGGroupNode and JGFolderNode. I have selectedIndexPaths on NSTreeController bound to an NSArray called selectedIndexPaths in my App Delegate. On startup, I search for group nodes and if they're not found in the core data store I create them: if ([allGroupNodes count] == 0) { JGGroupNode *rootTrainingNode = [JGGroupNode insertInManagedObjectContext:context]; [rootTrainingNode setNodeName:@"TRAIN"]; JGProjectNode *childUntrainedNode = [JGProjectNode insertInManagedObjectContext:context]; [childUntrainedNode setParent:rootTrainingNode]; [childUntrainedNode setNodeName:@"Untrained"]; JGGroupNode *rootBrowsingNode = [JGGroupNode insertInManagedObjectContext:context]; [rootBrowsingNode setNodeName:@"BROWSE"]; JGFolderNode *childFolder = [JGFolderNode insertInManagedObjectContext:context]; [childFolder setNodeName:@"Folder"]; [childFolder setParent:rootBrowsingNode]; [context save:nil]; } What I Want When I start the app, I want both top level groups to be expanded and "Untrained" to be highlighted as shown: The Problem I put the following code in the applicationDidFinishLaunching: method of the app delegate: [sourceListOutlineView expandItem:[sourceListOutlineView itemAtRow:0]]; [sourceListOutlineView expandItem:[sourceListOutlineView itemAtRow:2]]; NSIndexPath *rootIndexPath = [NSIndexPath indexPathWithIndex:0]; NSIndexPath *childIndexPath = [rootIndexPath indexPathByAddingIndex:0]; [self setSelectedIndexPaths:[NSArray arrayWithObject:childIndexPath]]; but the outline view seems to not have been prepared yet, so this code does nothing. Ideally, eventually I want to save the last selection the user had made and restore this on a restart. The Question I'm sure it's possible using some crazy KVO to observe when the NSTreeController or NSOutlineView gets populated then expand the items and change the selection, but that feels clumsy and too much like a work around. How would I do this elegantly?

    Read the article

  • Heterogeneous NSTreeController

    - by andyvn22
    I have an NSTreeController (supplying content to an NSOutlineView). I'd like the top-level objects to be of one class, and all other objects (so, children at any level) to be of another. What's the best way to go about this? I'll need to somehow change the behavior of at least add, addChild, insert, and insertChild, I suppose. I was hoping, though, to find a simple way to account for this in only one location, rather than changing four separate methods.

    Read the article

  • Make NSFormatter validate NSTextFieldCell continuously

    - by harms
    In Cocoa, I have an NSOutlineView where the cells are NSTextFieldCell. The cell displays values which are strings that are formatted according to certain rules (such as floats or pairs of floats with a space in between). I have made a custom NSFormatter to validate the text, and this seems to work with no problem. However, the cell (or the outline view, I'm unsure what is causing this) only seems to use the formatter at the moment my editing would end. If I type some alphabetic characters into the text field (which violates the formatting rules), these characters show up -- the only way I notice the formatter doing its job is that I'm now prevented from moving keyboard focus away from this cell. If I return the contents of the cell to a valid form, then I can move focus away. I have set both the cell and the outline view to be "continuous". It would be better if I was unable to enter text into the cell in the first place. Is it possible to make it like that, and if so, how?

    Read the article

  • Outline view from UITableView

    - by Raj
    Hi guys, I need to implement a 1 level outline view out of UITableView. The cells which have children in them will have a '+' symbol and if user taps on it, the cells below it should slide down and the children cells of current selected row should appear. The sliding of cells should be visible and if the user taps '-' button of the already expanded row, the children cells should slide back into the parent. I have tried googling but did not find any pointers. How should I start, should I subclass UITableView? Or should I implement my own view sub-class and handle all the stuff there? I somehow feel it would be easier to sub-class UITableView because it will handle all the row selection for us, but I cannot figure out how to do it. Thanks and Regards, Raj

    Read the article

  • Cocoa Drag and Drop, reading back the data

    - by kodai
    Ok, I have a NSOutlineView set up, and I want it to capture PDF's if a pdf is dragged into the NSOutlineView. My first question, I have the following code: [outlineView registerForDraggedTypes:[NSArray arrayWithObjects:NSStringPboardType, NSFilenamesPboardType, nil]]; In all the apple Docs and examples I've seen I've also seen something like MySupportedType being an object registered for dragging. What does this mean? Do I change the code to be: [outlineView registerForDraggedTypes:[NSArray arrayWithObjects:@"pdf", NSStringPboardType, NSFilenamesPboardType, nil]]; Currently I have it set up to recognize drag and drop, and I can even make it spit out the URL of the dragged file once the drag is accepted, however, this leads me to my second question. I want to keep a copy of those PDF's app side. I suppose, and correct me if I'm wrong, that the best way to do this is to grab the data off the clipboard, save it in some persistant store, and that's that. (as apposed to using some sort of copy command and literally copying the file to the app director.) That being said, I'm not sure how to do that. I've the code: - (BOOL)outlineView:(NSOutlineView *)ov acceptDrop:(id <NSDraggingInfo>)info item:(id)item childIndex:(NSInteger)childIndex { NSPasteboard *pboard = [info draggingPasteboard]; NSURL *fileURL; if ( [[pboard types] containsObject:NSURLPboardType] ) { fileURL = [NSURL URLFromPasteboard:pboard]; // Perform operation using the file’s URL } NSData *data = [pboard dataForType:@"NSPasteboardTypePDF"]; But this never actually gets any data. Like I said before, it does get the URL, just not the data. Does anyone have any advise on how to get this going? Thanks so much!

    Read the article

1 2  | Next Page >