Re: Highlighting a valid drop target (serious dead end)
Re: Highlighting a valid drop target (serious dead end)
- Subject: Re: Highlighting a valid drop target (serious dead end)
- From: Keith Blount <email@hidden>
- Date: Thu, 20 Apr 2006 09:59:36 -0700 (PDT)
Thanks for the advice, particularly about not
speculating on methods (that was a tip I picked up
elsewhere and it seemed like a good idea at the time,
but I see now how it might not be and will correct my
code accordingly).
Unfortunately there are two private methods that I
have had to override in my own
NSOutlineView/NSTableView subclasses:
_drawDropHighlightOnRow: and _highlightColorForCell:.
> What is it not doing
> that you want it to do?
Same as the original poster, I need a custom drop
highlight; I also need custom row highight colouring.
Most new Apple apps (well, anything since Panther,
really) have gradient highlights in table/outline
views (see every iApp, Mail etc) and rounded-rect drop
highlights (Finder etc), so apps that use the default
highlighting look ugly and clunky by comparison. I
also have a keywords panel that emulates the look of
the one in Aperture (ie. it is mostly nearly black and
is an overlay window), for which I need white
highlighting and drop highlighting (the default black
would hardly be visible). Unfortunately, as things
stand at the moment, I have no way of implementing
these without overriding private methods. I would
rather not override private methods (and these are the
only two private methods I override in the thousands
of lines of code in my app), but currently there is no
other way. If I am wrong and there is a supported way
to provide these features, I would be very grateful to
hear about them.
Anyway, as you suggest, I will now head off to the bug
reporter and file an enhancement request on both of
these features, which I should have done months ago.
Thanks for taking the time to put me right,
All the best,
Keith
--- Corbin Dunn <email@hidden> wrote:
>
> On Apr 16, 2006, at 1:53 PM, Keith Blount wrote:
>
> > A private table/outline view method handles the
> > highlighting of the drop target, namely:
> >
> > -(void)_drawDropHighlightOnRow:(int)rowIndex
>
> I don't recommend overriding private methods; it can
> cause
> compatibility issues with future releases.
> Unfortunately, there isn't
> an easy way to customize the drop highlighting. What
> is it not doing
> that you want it to do?
>
> >
> > Override that method in your outline view subclass
> and
> > draw your own highlight around the row there.
> > (Obviously the usual warnings apply with regard to
> > using a private method - you might want to
> implement
> > -drawDropHighlightOnRow: as well, just in case
> Apple
> > make this method public soon.)
>
> Please don't do this -- speculating about potential
> method names is a
> bad idea. What if your speculative implementation
> calls the private
> method _drawDropHighlightOnRow. Then, what if
> NSTableView adds
> drawDropHighilghtOnRow, and the old
> _drawDropHighlightOnRow then calls
> drawDropHighilghtOnRow; it is very easy to
> accidentally introduce an
> infinite loop in cases like this.
>
> One of the best things you can do if you need to
> override a private
> method is to let Apple know. Please log a feature
> request or bug! The
> more track record Apple has of people wanting
> particular features, the
> more likely it will get done. Searching for
> _drawDropHighlightOnRow
> reveals quite a few hits...so quite a few people are
> probably wanting
> that method. That's good to know!
>
> thanks!
> -corbin
>
>
> >
> > HTH,
> > Keith
> >
> >
> > --- ORIGINAL MESSAGE ---
> >
> > Hi,
> > I am asking for help one more time, because all my
> > efforts (been working for
> > nights now) have seriously come to a dead end.
> > In my apps view I use DND to alter the data in its
> > model (by dragging from a
> > NSTableView to a NSOutlineView). I already changed
> the
> > drag image to fit
> > into my apps overall design. But since then I used
> >
> > - (void)outlineView:(NSOutlineView *)outlineView
> > willDisplayCell:(id)cell
> > forTableColumn:(NSTableColumn
> *)tableColumn
> > item:(id)item
> >
> > And
> >
> > - (unsigned int)outlineView:(NSOutlineView*)olv
> > validateDrop:(id
> > <NSDraggingInfo>)info proposedItem:(id)item
> > proposedChildIndex:(int)childIndex
> > As well as
> >
> > - (NSDragOperation)draggingEntered:(id
> > <NSDraggingInfo>)sender,
> >
> > to alter the visualization of valid drop targets
> (in
> > my outline view) as
> > well. But - although I was able to
> �add�
> > some highlighting behaviour when
> > dragging to a valid destination - I just
> can�t
> > get rid of the default black
> > rectangle cocoa provides in such a case.
> > Who is responsible for creating this? What method
> do I
> > have to override to
> > replace it by my own drop target highlighting
> > behaviour?
> > Is there something about it somewhere in the
> > documentation?
> >
> > Any suggestions appreciated,
> > Peter
>
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden