Re: Getting NSScrollView to ignore scrolling

2011-02-20 Thread Andrew Shamel
Hurrah!  It was as easy as this:

- (void)scrollWheel:(NSEvent *)theEvent
{
[[self nextResponder] scrollWheel:theEvent];
}

Thanks, y'all!

— andy


On Feb 19, 2011, at 4:48 PM, Quincey Morris wrote:

 On Feb 19, 2011, at 16:25, Peter Lübke wrote:
 
 My question is this: how do I get the scroll view to ignore scrolling 
 messages?  The tables/scrollviews are sitting on views that are part of a 
 homebrew collection view, and the scrolling catches on them, even though 
 there's no scrolling to be done.  The scroll view is taking the events, but 
 there is nothing for them to do. I want to be able to scroll past the table 
 using a scrollwheel or the trackpad without the scrolling action catching.
 
 
 What do you mean with scroll past the table?
 
 I'm pretty sure the OP is talking specifically about scrolling with the 
 scroll wheel. (It sounds like the individual table views in his view 
 collection don't have scroll bars, and are sized to show all their content 
 anyway.) In that case, the table views or scroll views are still responding 
 the scroll wheel, which prevents the collection view itself from scrolling.
 
 I think the only way to fix this is to override the appropriate 
 'scrollWheel:' event method, and to pass the event on up the responder chain. 
 NSScrollView's documentation lists that method, so presumably that's the 
 appropriate method, and so it would be necessary to subclass NSScrollView, 
 override 'scrollWheel:' and figure out a way of bypassing the NSScrollView 
 implementation (since the usual '[super scrollWheel:]' technique won't 
 achieve that here). I guess you'd have to walk the responder chain manually 
 (not normally recommended), or find the NSScrollView's superclass's 
 implementation via the 'objc_...' runtime routines (not normally 
 recommended), although maybe there's a simpler way that's just not occurring 
 to me right now.
 
 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Getting NSScrollView to ignore scrolling

2011-02-19 Thread Andrew Shamel
HI All,

I have a NSTableView/NSScrollView setup that I've configured automatically to 
resize to contain the content of the table.  This may sound silly, but I don't 
want scrolling behavior, but NSTableView seems to be designed to be inside a 
NSScrollView.  

My question is this: how do I get the scroll view to ignore scrolling messages? 
 The tables/scrollviews are sitting on views that are part of a homebrew 
collection view, and the scrolling catches on them, even though there's no 
scrolling to be done.  The scroll view is taking the events, but there is 
nothing for them to do.  I want to be able to scroll past the table using a 
scrollwheel or the trackpad without the scrolling action catching.

Any ideas?

Thank you so much!!

Pax,

Andy Shamel___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Selection in NSCollectionView

2010-11-02 Thread Andrew Shamel
Hi there great and wise Cocoa-Dev!

I am wondering if anyone knows if there has been any movement regarding how 
selection is handled in NSCollectionViews.  I see there was some conversation 
on this subject a couple of years back 
(http://www.cocoabuilder.com/archive/cocoa/217489-selection-in-nscollectionview.html),
 and I'm having similar trouble.

My desire is this: when the user clicks anywhere in a collection subview (i.e., 
not just on the base view, but on any controls within that view), the 
collection view takes not and selects it as would be intuitive.

I am simply using the default Interface Builder tools here, building my view 
there, though I'm not, of course, afraid of subclassing.

Thank you so much!

Pax,

Andy___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTokenField: binding + disappearing tokens

2010-02-12 Thread Andrew Shamel
Hi there!

I am having a bizarre problem with NSTokenField.  In Interface Builder, having 
bound the field's value binding to an NSArrayController containing 
NSManagedObjects, and passing the value through a ValueTransformer, the field's 
tokens show up, displaying the proper values.  However, when the mouse enters 
and then leaves, the tokens disappear (unless the mouse leaves by the top of 
the field).  Weird, right?  I can find no reason why this should be so.

Any thoughts would be vastly appreciated!

Peace,

andy shamel



Here are the configurations:

Relevant Core Data Entity info

Name: Character
Relationship: named seniorArtisan to-one, connected to Character

The NSArrayController is set to Entity mode, with the Character entity.  
Prepares content, managedObjectContext bound to App Delegate

The NSTokenField is bound in Interface Builder with default options to the 
above NSArrayController, Controller Key: selection, Model Key Path: 
seniorArtisan, and Value Transformer: TokenRelationshipTransformer

Here's the TokenRelationshipTransformer's code:

+ (void)initialize
{
[TokenRelationshipTransformer 
setValueTransformer:[[[TokenRelationshipTransformer alloc] init] autorelease] 
forName:@TokenRelationshipTransformer]; 
}

+ (Class)transformedValueClass
{
return [NSArray class];
}

+ (BOOL)allowsReverseTransformation
{
return YES;
}

- (id)transformedValue:(id)value
{   
NSLog(@transforming value: %@,value);
if ([value isKindOfClass:[NSSet class]]) {
return [value allObjects];
} else if (value != nil) {
return [NSArray arrayWithObject:value];
} else {
return nil;
}
}

- (id)reverseTransformedValue:(id)value
{
NSLog(@reversing value: %i,[value count]);

if (value == nil) {
return nil;
} else if ([(NSArray *)value count] == 1) {
NSLog(@reverse transforming 1);
return [(NSArray *)value objectAtIndex:0];
} else {
NSLog(@reverse transforming more than 1);
return [NSSet setWithArray:value];
}

return value;
}

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSOutlineView + selectionIndexPaths binding

2010-01-20 Thread Andrew Shamel
Hi All,

I've dug around in the archives and found several threads addressing this 
question, but the solutions don't seem to work.

NB: all binding was done in Interface Builder

I have an NSOutlineView with its only column bound at 
treeController.arrangedObjects.name to an NSTreeController that manages a Core 
Data entity called Collection with the property name.

The NSOutlineView's dataSource IBOutlet is connected to a custom class 
CollectionViewController for the purposes of handling drag and drop.

What I would like to do is bind the NSOutlineView's selectionIndexPaths binding 
to the NSTreeController's selectionIndexPaths key.  When I do this, however, I 
get back this error:

Illegal NSOutlineView data source (CollectionViewController: 0x1001722d0).  
Must implement outlineView:numberOfChildrenOfItem:, 
outlineView:isItemExpandable:, outlineView:child:ofItem: and 
outlineView:objectValueForTableColumn:byItem:

and there is nothing in the NSOutlineView (or any other bound views for that 
matter).

I tried implementing dummy versions of those NSOutlineViewDataSource methods 
(that return negative or nil values), as I have seen recommended in the 
archives, but this also results in a host of empty views.

Have there been any developments on this front?  Is there any way to bind the 
selectionIndexPaths binding while still using bindings for the NSOutlineView's 
data?

Any and all feedback is most appreciated!

Pax,

andy___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSOutlineView + selectionIndexPaths binding

2010-01-20 Thread Andrew Shamel
Thanks for your help!

I am indeed working with Snow Leopard.

Here are my bindings  configuration:

— NSTreeController, IB Name Collections

Mode: Entity
Entity Name: Collection
Children Key Path: children [a relationship on the Collection managed object]
Prepares Content: YES
Editable: YES
Fetch Predicate: parent == nil

Selection Index Paths binding: 
- Bound to: Shared User Defaults Controller
- Controller Key: values
- ModelKeyPath: collectionSelectionIndexPaths
- Raises for Not Applicable Keys: YES

— CollectionOutlineController

Custom Class for handling drag and drop

— NSOutlineView

Connected to CollectionOutlineController at:
- dataSource
- delegate

Selection Index Paths binding: 
- Bound to: Collections (NSTreeController)
- Controller Key: selectionIndexPaths
- Raises for Not Applicable Keys: YES

— NSOutlineView (Table Column)

Value binding:
- Bound to: Collections
- Controller Key: arrangedObjects
- Model Key Path: name
- Allows Editing Multiple Values Selection: YES
- Conditionally Sets Enables: YES
- Creates Sort Descriptor: YES
- Raises for Not Applicable Keys: YES

These are the settings that raise the dataSource error.

Thanks again for your help!

Peace,

Andy



On Jan 20, 2010, at 9:49 PM, Scott Anguish wrote:

 I’m assuming Snow Leopard
 
 It sounds like they’re marked as @required in the header, but 
 
 @optional
 
 /* Required methods
 */
 - (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index 
 ofItem:(id)item;
 - (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item;
 - (NSInteger)outlineView:(NSOutlineView *)outlineView 
 numberOfChildrenOfItem:(id)item;
 - (id)outlineView:(NSOutlineView *)outlineView 
 objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item;
 
 they aren’t.
 
 Implementing stubs for them won’t help. It sounds like a bindings issue.
 
 What specifically are your bindings?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSTextView, Bindings, and Display Updates

2009-11-19 Thread Andrew Shamel
Hi All,

I'm having a strange behavior with an NSTextView bound through Interface 
Builder to a Core Data backing. The textView is part of a standard 
master-detail setup, and is not updating its value when the selection is 
changed in the master list.  The value only displays after the mouse has 
entered the textView's frame.  It stays there until the master selection 
changes, at which point I have to wave the mouse through it to get the new 
value to appear.

Any ideas?

Thanks so much,

Andy Shamel___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSComboboxCell + setButtonBordered:

2009-09-04 Thread Andrew Shamel

Hi all,

I am having trouble with NSComboBoxCell's setButtonBordered: setting,  
having just updated to the latest XCode+IB versions in Snow Leopard.   
It appears that my choices are now between a bordered button with one  
arrow (setButtonBordered:YES) or a bordered button with two arrows  
(setBorderedButton:NO).


Does anyone know, is this an intentional change, a known problem, or  
am I just missing something?


Thanks so much for your help,

Peace,

Andy Shamel
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Expanding NSScrollView

2009-07-21 Thread Andrew Shamel

Hi All,

I've dug around through the archives, but couldn't turn anything up  
that addresses this question, so I turn to the collective wisdom of  
the list.


I'm trying to figure out how to create an NSScrollView subclass that  
expands vertically rather than scrolling, up to a certain height.  For  
instance, a scrollview containing an NSTextView would expand itself  
when the textview exceeded the visible  rect, until the textview  
reached a certain length, at which point normal scrolling behavior  
would commence.  Likewise, it would shrink back along the same  
parameters.


I am imagining that this might have something to do with the ClipView,  
but I may be way off.  Alternatively a scrollViewShouldScroll:  
delegate method would be convenient at this point.


If that wasn't coherent, or if anyone has any ideas, I would be  
sincerely grateful.


Peace,

Andy Shamel
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Expanding NSScrollView

2009-07-21 Thread Andrew Shamel

Thanks for the quick response!

I'm looking for it to expand as its documentView expands.

The scrollviews are contained in a custom view called CardView, which  
is itself inside a scrollview which I am happy to have act in the  
usual fashion as the CardView gets taller and shorter as a result of  
its expanding and contracting contents.  The custom scrollviews are  
arranged in a vertical stack within the CardView, and need to retain  
the same relative distance to one another as they expand and  
contract.  I believe I have this relative change in position handled.   
It's finer control over the expansion of the scrollview itself that  
I'm after.


I have two configurations: one containing an NSTextView, and one  
containing an NSTableView.


For the one containing the textview, i want the scrollView to expand  
as the textView does (rather than letting the textView become hidden  
inside the scrollView), up until the textView has four lines of text  
at which point, normal scrolling behavior starts (i.e., the content  
which will not be in view is hidden and the scrollbars activate).


For the one containing the tableview, I'm looking for similar  
behavior, only replacing four lines of text with four rows in the  
table.


I have managed to implement this behavior manually, based on checking  
the size of the content and the size of the scrollview each time the  
data is changed (i.e., implementing the textDidChange: delegate  
method, and monitoring the tableview's data source for new rows)


Where I am having trouble is in figuring out how to implement the  
behavior reliably when the CardView is automatically resized, for  
instance, as the window is resized.  I was hoping therefore, to figure  
out a more generalized method of getting the scrollview or some  
delegate to do it automatically, observing the size of its content as  
the content is resized, and resizing the content as it is resized by  
its superview.


As an example:

given:

CardView *card // assigned elsewhere
NSScrollView *scroller //assigned elsewhere

[card addSubview:scroller];

NSTextView *textView = [scroller documentView];

Say textView has a sentence of text in it that fits on one line when  
card is at a given width. In textView, I add another sentence,  
expanding to two lines of text.  At this point, scroller should get  
taller to accommodate the text.  When card shrinks as the window  
shrinks horizontally, scroller is resized as per its autosizing  
settings.  As card and scroller get narrower, what had once fit on two  
line is now forced onto three.  Normally, this would activate the  
scrollbars and all kinds of scrolling joy would commence.  I want to  
be able to control its vertical expansion relative to the needs of the  
text inside it.  As the views narrow, rather than expanding wantonly  
as they might with autosizing settings, I want to retain the fine  
control I have when new text is entered, so as to control when and how  
it grows and/or applies scrolling behavior.


Whew!  I hope that's clearer.

Thanks again for your help.

— a


On 21 Jul 2009, at 12:12 PM, Quincey Morris wrote:


On Jul 21, 2009, at 11:55, Andrew Shamel wrote:

I'm trying to figure out how to create an NSScrollView subclass  
that expands vertically rather than scrolling, up to a certain  
height.


Expands vertically when what? When the window is resized? Or is it  
supposed to resize its window when it wants to expand?


Expands vertically into what? Are there other elements around it  
that have to be moved out of the way? Is it the sole content of the  
window?


If you can answer those questions, you'll know what to do with the  
scroll view.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mercator%40pileofdebris.com

This email sent to merca...@pileofdebris.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ImageAndTextCell rendering weirdness

2009-01-21 Thread Andrew Shamel
So, I still haven't had any luck figuring this problem out.  However,  
upon reading through the code of the Source View example, I'm  
wondering if it has something to do with the fact that I'm using an  
NSTreeController bound to a Core Data structure with  
ImageAndTextCell.  Source View uses an NSTreeController, but populates  
it with its own ChildNode objects, rather than the default NSTreeNode  
that the controller uses when working with NSManagedObjects (that is,  
in Entity mode).


Does anyone know if this sounds reasonable?  If so, is there any way  
of getting NSTreeController to use a custom node object while still  
maintaining Core Data support?


I hope that makes some sense.

Thank you all for your help.

Peace,

Andy Shamel


On 17 Jan 2009, at 11:23 AM, Sandy McGuffog wrote:

Well, I haven't seen this specific behavior. But one thought is to  
check that your images have their size set - as initialized from a  
[NSImage imageNamed:], size is not set(!). This can cause all sort  
of havoc. Second comment: there are actually several different  
versions of ImageandTextCell in different developer docs; you might  
want to try the more recent versions, if you're not already.  
Depending on which version you have, the setSize may be being done  
for you. Or not.


Sandy


On Jan 17, 2009, at 8:26 PM, Andrew Shamel wrote:


Greetings Cocoa-Dev!

I am having the hardest time with a persistent and strange error  
with Apple's ImageAndTextCell in my NSOutlineView.


I have the ImageAndTextCell set to be the outline's data cell via  
NSTableColumn's -setDataCell: method, and I set the image of the  
cell in the outlineView's delegate, using -  
(void)outlineView:willDisplayCell:forTableColumn:item:  And here's  
where the trouble starts.


The problem I am encountering is this: When I have an image set in  
the cell, and I go to edit the text of the *first* item in any  
particular set of children, after the first keystroke, the text  
field goes haywire, turning white, with the text appearing only as  
shadow lines, and editing stops.  If I click off the cell, the mess  
goes away, the one keystroke's worth of edit remains, but does not  
get noticed by the bindings.


Here is a picture of what happens: http://www.pileofdebris.com/editError.png

Does anyone have any thoughts about why this might be happening?   
I've figured out that if my willDisplayCell: delegate method is  
empty, this does not happen.  Here is the code for that method,  
should it be of any help.


- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell: 
(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item

{
NSManagedObject *node = [item representedObject];
NSString *type = [node valueForKey:@type];
NSString *tag = [node valueForKey:@tag];

if ([type isEqual:@collection]) {
[cell setImage:[self defaultFolderImage]];
} else if ([type isEqual:@library]) {
if ([tag isEqual:@booksLibrary]) {
[cell setImage:[self booksLibraryImage]];
} else if ([tag isEqual:@articlesLibrary]) {
[cell setImage:[self articlesLibraryImage]];
} else {
[cell setImage:[self articlesLibraryImage]];
}
} else if ([type isEqual:@section]) {
[cell setImage:nil];
[cell setEditable:NO];
[cell setSelectable:NO];
} else if ([type isEqual:@smartCollection]) {
[cell setImage:[self smartFolderImage]];

}
}

Thanks so much for any input people can offer.

pax,

Andy S.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mcguffogl 
%40gmail.com


This email sent to mcguff...@gmail.com




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ImageAndTextCell rendering weirdness

2009-01-17 Thread Andrew Shamel

Greetings Cocoa-Dev!

I am having the hardest time with a persistent and strange error with  
Apple's ImageAndTextCell in my NSOutlineView.


I have the ImageAndTextCell set to be the outline's data cell via  
NSTableColumn's -setDataCell: method, and I set the image of the cell  
in the outlineView's delegate, using -  
(void)outlineView:willDisplayCell:forTableColumn:item:  And here's  
where the trouble starts.


The problem I am encountering is this: When I have an image set in the  
cell, and I go to edit the text of the *first* item in any particular  
set of children, after the first keystroke, the text field goes  
haywire, turning white, with the text appearing only as shadow lines,  
and editing stops.  If I click off the cell, the mess goes away, the  
one keystroke's worth of edit remains, but does not get noticed by the  
bindings.


Here is a picture of what happens: http://www.pileofdebris.com/editError.png

Does anyone have any thoughts about why this might be happening?  I've  
figured out that if my willDisplayCell: delegate method is empty, this  
does not happen.  Here is the code for that method, should it be of  
any help.


- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell: 
(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item

{
NSManagedObject *node = [item representedObject];
NSString *type = [node valueForKey:@type];
NSString *tag = [node valueForKey:@tag];

if ([type isEqual:@collection]) {
[cell setImage:[self defaultFolderImage]];
} else if ([type isEqual:@library]) {
if ([tag isEqual:@booksLibrary]) {
[cell setImage:[self booksLibraryImage]];
} else if ([tag isEqual:@articlesLibrary]) {
[cell setImage:[self articlesLibraryImage]];
} else {
[cell setImage:[self articlesLibraryImage]];
}
} else if ([type isEqual:@section]) {
[cell setImage:nil];
[cell setEditable:NO];
[cell setSelectable:NO];
} else if ([type isEqual:@smartCollection]) {
[cell setImage:[self smartFolderImage]];

}
}

Thanks so much for any input people can offer.

pax,

Andy S.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: ImageAndTextCell rendering weirdness

2009-01-17 Thread Andrew Shamel
Thanks, Sandy.  I found a later version (in the Source View example  
code), and alas, even with the size set, the same thing is happening.


I confess that I don't know as much about view/cell drawing as I  
might.  Has anyone seen this kind of rendering before, if not in this  
situation?


Thanks so much,

Andy



On 17 Jan 2009, at 11:23 AM, Sandy McGuffog wrote:

Well, I haven't seen this specific behavior. But one thought is to  
check that your images have their size set - as initialized from a  
[NSImage imageNamed:], size is not set(!). This can cause all sort  
of havoc. Second comment: there are actually several different  
versions of ImageandTextCell in different developer docs; you might  
want to try the more recent versions, if you're not already.  
Depending on which version you have, the setSize may be being done  
for you. Or not.


Sandy


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


ImageAndTextCell + NSOutlineView editing problem

2009-01-14 Thread Andrew Shamel

Greetings Cocoa-Dev!

I am having the hardest time with a persistent and strange error with  
Apple's ImageAndTextCell in my NSOutlineView.


I have the ImageAndTextCell set to be the outline's data cell via  
NSTableColumn's -setDataCell: method, and I set the image of the cell  
in the outlineView's delegate, using  -  
(void)outlineView:willDisplayCell:forTableColumn:item:  And here's  
where the trouble starts.


The problem I am encountering is this: When I have an image set in the  
cell, and I go to edit the text of the *first* item in any particular  
set of children, after the first keystroke, the text field goes  
haywire, turning white, with the text appearing only as shadow lines,  
and editing stops.  If I click off the cell, the mess goes away, the  
one keystroke's worth of edit remains, but does not get noticed by the  
bindings.


Here is a picture of what happens: http://www.pileofdebris.com/editError.png

Does anyone have any thoughts about why this might be happening?  I've  
figured out that if my willDisplayCell: delegate method is empty, this  
does not happen.  Here is the code for that method, should it be of  
any help.


- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell: 
(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item

{
NSManagedObject *node = [item representedObject];
NSString *type = [node valueForKey:@type];
NSString *tag = [node valueForKey:@tag];

if ([type isEqual:@collection]) {
[cell setImage:[self defaultFolderImage]];
} else if ([type isEqual:@library]) {
if ([tag isEqual:@booksLibrary]) {
[cell setImage:[self booksLibraryImage]];
} else if ([tag isEqual:@articlesLibrary]) {
[cell setImage:[self articlesLibraryImage]];
} else {
[cell setImage:[self articlesLibraryImage]];
}
} else if ([type isEqual:@section]) {
[cell setImage:nil];
[cell setEditable:NO];
[cell setSelectable:NO];
} else if ([type isEqual:@smartCollection]) {
[cell setImage:[self smartFolderImage]];

}
}

Thanks so much for any input people can offer.

pax,

Andy S.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSOutlineView initial expansion

2008-12-03 Thread Andrew Shamel
I've trolled through the archives looking for help on this, but I  
can't seem to find anything that quite works.  I'm trying to set it up  
such that an NSOutlineView starts out  fully expanded.  In the  
delegate, I have the following code:


- (void)awakeFromNib
{
[outline expandItem:nil expandChildren:YES];
}

I feel like I'm missing something rather obvious, since the same code  
works when it's attached to a button.  Is there a better place to put  
it than in awakeFromNib:?


Thank you so much both for your help and your patience.

Peace,

Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSOutlineView initial expansion

2008-12-03 Thread Andrew Shamel

Ahh, brilliant!!  It worked a treat.

Thanks so much!




Try delaying your call to expandItem: in your awakeFromNib.

- (void)expandAllItems {
[outline expandItem:nil expandChildren:YES];
}

- (void)awakeFromNib {
/* snip */

	[self performSelector:@selector(expandAllItems) withObject:nil  
afterDelay:0.0];

}


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]