🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
4 messages
4 total messages Started by Scott Hess Mon, 17 Aug 1992 14:20
Drag&drop of colors in Views - how does -acceptColor:atPoint: work?
#1194
Author: Scott Hess
Date: Mon, 17 Aug 1992 14:20
30 lines
1711 bytes
[Sorry if this article is a repeat - but it never seemed to show
up on our newsfeed, and nobody's replied anyhow.  Perhaps we've
got NNTP problems?  I don't know.]

From View.rtf:

    acceptColor:atPoint:
    - acceptColor:(NXColor)color atPoint:(NXPoint *)aPoint
    
	Allows a View to accept a color.  If your subclass of View
	implements this method, it will be invoked when the user
	drags a color (as from an NXColorWell) into your View.

So, I implement -acceptColor:atPoint:.  All it does yet is
printf( "Here I am!\n").  But, when I pop up a color panel, and
drag a color into the View, nothing happens.  No printf, and later,
when I add code to do something else, like change the View's color,
that doesn't happen, either.

So, what's up?  Am I just not doing something right?  There's not
much area to go wrong, here, and I've checked the spelling against
the documentation about a billion times.  It just doesn't seem to
work.  Anyone out there got an example of receiving colors for your
View?

Later,
--
scott hess <shess@ssesco.com>  <Who achieved programmer nirvana on Aug 11th>
12901 Upton Avenue South, #326  Burnsville, MN 55337 (612) 895-1208 Anytime!
   <Text: One Class to bring them all and in the darkness bind them ...>
Re: Drag&drop of colors in Views - how does -acceptColor:atPoint: work?
#1201
Author: Glenn Reid
Date: Tue, 18 Aug 1992 03:53
20 lines
1165 bytes
Scott Hess writes
> So, I implement -acceptColor:atPoint:.  All it does yet is
> printf( "Here I am!\n").  But, when I pop up a color panel, and
> drag a color into the View, nothing happens.  No printf, and later,
> when I add code to do something else, like change the View's color,
> that doesn't happen, either.

There's an appkit bug in View that makes acceptColor: not work for flipped
views.

If your view is flipped, try it the other way around to see if it
starts to work for you.

I have a fix (subclass) somewhere that I can probably send you if
this is indeed the problem.

--
 Glenn Reid        		NeXTmail: glenn@rightbrain.com
 RightBrain Software		415-326-2974 (NeXTfax 326-2977)
 Palo Alto, California
Re: Drag&drop of colors in Views - how does -acceptColor: atPoint: work?
#1207
Author: Pete Clark
Date: Tue, 18 Aug 1992 06:32
34 lines
1666 bytes
In article <SCOTT.92Aug17092008@nic.gac.edu>  writes:
> So, what's up?  Am I just not doing something right?  There's not
> much area to go wrong, here, and I've checked the spelling against
> the documentation about a billion times.  It just doesn't seem to
> work.  Anyone out there got an example of receiving colors for your
> View?
> 

Scott:

	This class works as expected under 3.0PR2. The instance of MyView is a  
subview of a Box, which is in a Window. 

@implementation MyView
- acceptColor:(NXColor)color atPoint:(NXPoint *)aPoint
{
	printf("ouch!\n");
	return self;
}
@end

	Other advice:
	1) Are you sure that your view is an instance of the right object,  
rather than being a CustomView?
	2) Is there a superview of your view that might be catching that  
message?

	Best,
		Pete C
-- 
*********************************************************************
Pete Clark -	 Software Engineer          | You know that way that  
Integrity Solutions, Inc.                    | you always are?
pclark@is.com    NeXTMail preferred           | Don't be that way.
Re: Drag&drop of colors in Views - how does -acceptColor: atPoint: work?
#1212
Author: Scott Hess
Date: Tue, 18 Aug 1992 19:42
39 lines
2493 bytes
In article <1992Aug18.063238.3891@bosslogic.com>
	pclark@bosslogic.com (Pete Clark) writes:
>In article <SCOTT.92Aug17092008@nic.gac.edu>  writes:
>> So, what's up?  Am I just not doing something right?  There's not
>> much area to go wrong, here, and I've checked the spelling against
>> the documentation about a billion times.  It just doesn't seem to
>> work.  Anyone out there got an example of receiving colors for your
>> View?
>
>	This class works as expected under 3.0PR2. The instance of
>MyView is a subview of a Box, which is in a Window.

In order to hamstring the minor groundswell of response I've been
receiving, I figure I'll post this on the net and let everyone in
on The Real Dope.  The method _does_ work, with qualifications.
Apparently, if the receiving View is flipped, the test for whether
the swatch is in the View is wrong, so you don't get the message
when the drop is in the View - you get it when the drop is _above_
the View!  [Didn't they use View's -mouse:inRect:?]

In any case, there are a couple alternatives.  An obvious and
workable one is to do [myView setFlipped:NO].  I did that, and
things work awesome.

Another solution is the NextAnswers solution.  It uses a +poseAs:
on NXColorPanel which overrides +dragColor:withEvent:fromView: to
do things the right way.  I'm sure this works fine - it is a bit
involved, though.  Unflipping the View works much better with less
fuss and muss, when applicable.

[Some might ask "Why didn't scott check NextAnswers in the first
place?"  I did.  My index was screwed up, though, so the search
didn't turn up anything ...]

Later,
--
scott hess <shess@ssesco.com>  <Who achieved programmer nirvana on Aug 11th>
12901 Upton Avenue South, #326  Burnsville, MN 55337 (612) 895-1208 Anytime!
   <Text: One Class to bring them all and in the darkness bind them ...>
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads