Re: Anybody know how to use NSHighlightRect ?
Re: Anybody know how to use NSHighlightRect ?
- Subject: Re: Anybody know how to use NSHighlightRect ?
- From: "John C. Randolph" <email@hidden>
- Date: Mon, 7 Oct 2002 12:46:26 -0700
One other approach you might want to investigate is to put your
selection marker into a separate window, and let the compositor take
care of rendering the overlay. The example at
http://developer.apple.com/samplecode/Sample_Code/Cocoa/
RoundTransparentWindow.htm
Will show you how to make a window with arbitrary contents.
-jcr
On Monday, October 7, 2002, at 04:16 AM, Robert Miller wrote:
John,
Thanks for the heads up regarding the CroppedImage example. The
problem I have though is that I do not want to have to incur the
overhead of a setNeedsDisplay for what lies underneath the selection
rect. I'm writing a spreadsheet application which subclasses
NSTableView and also subclasses NSCell. The NSCell subclass merely
examines a table cell's state to determine if it should be highlighted
or not beyond NSTableView's row / column restrictions. my selection
rect has resize capability for cell selection and is sluggish because
of the overhead of updating the cell text in real time. I'd like to be
able to just 'overlay' a selection rectangle and when it's size
changes not have to update the underneath as a means to erase the old
rectangle. Are there any ways to do this in Cocoa / Quartz, ? I've
read that Quartz does not support XOR drawing.
Thanks for any info. in advance,
Regards,
Bob M.
On Friday, October 4, 2002, at 04:44 PM, John C. Randolph wrote:
On Friday, October 4, 2002, at 01:09 PM, Robert Miller wrote:
Hello, please help,
Here goes another one of those seemingly basic questions that has
eroded some of my brain trying to figure out. Does anyone know how
to use NSHighlightRect ? I am trying to implement a live selection
rectangle which tracks mouse dragged and changes the size of the
rect from an anchor point. I'm keeping track of the last rectangle
and the new rectangle coordinates and calling the following >>> sequence.
[self lockFocus];
NSHighlightRect(lastRect);
NSHighlightRect(newRect);
[self unlockFocus];
I thought that NSHighlightRect was supposed to take care of the
drawing 'mode' using the current highlight color and provide a clean
efficient selection rect without the need to incur the overhead of
an actual view display call. I've tried changing the current
foreground color, etc just to see if anything happens but, nothing
is drawn at all, even if I never call it for the 'lastRect' you'd
think that there would at least be a rect drawn that doesn't erase
any old areas. I could swear that I saw NSHighlightRect work in the
past. Am I missing something (besides a few million brain cells) ?
The effect that NSHighlightRect() used to produce isn't used in the
Aqua UI guidelines. You might want to look at:
http://developer.apple.com/samplecode/Sample_Code/Cocoa/
Cropped_Image.htm
for an example of how to do selection rectangles for Aqua.
-jcr
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
John C. Randolph <email@hidden> (408) 974-8819
Sr. Cocoa Software Engineer,
Apple Worldwide Developer Relations
http://developer.apple.com/cocoa/index.html
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.