Re: Dragging Rect
Re: Dragging Rect
- Subject: Re: Dragging Rect
- From: Marco Binder <email@hidden>
- Date: Thu, 12 Jun 2003 10:59:09 +0200
As jcr already pointed out, it would be good to know what "objects" are
drawn inside the view. If the view manages those objects itself, it
should be a rather simple task to first draw them and then, ontop, the
selection rect.
However, using the display methods could work, but the are some
caveats. Especially one, i can think of right now: you have to flush
the graphics of the current graphics context in order to actually SEE
the drawings! Look at NSGrpahicsContext.
Generally, i think overriding display is a bad idea, if only for the
reason that I fiddeled about with it for a time and eventually ended up
in using the drawRect: method instead.
Marco
Am Mittwoch, 11.06.03, um 20:44 Uhr (Europe/Berlin) schrieb John Haney:
Lorenzo,
Time for Disclaimers: I don't consider myself an
expert and also I'm not on a mac now, so I'm trying to
help you with what resources I have...
Hopefully someone who has more experience messing with
drawing views can chime in with a fuller description.
Here's the next step (in my opinion) from your code
now... see the comments mixed in with your last
post...
--- Lorenzo <email@hidden> wrote:
Hi,
maybe I didn't understand well.
I override the -display method this way:
- (void)display
{
[self lockFocus];
if(isDragging){
NSLog(@"isDragging");
[[NSColor selectedControlColor] set];
NSFrameRect(dragRect);
}
[super display];
[self unlockFocus];
}
Try this instead...
- (void)display
{
[super display];
if(isDragging){
NSLog(@"isDragging");
[self lockFocus];
[[NSColor selectedControlColor] set];
NSFrameRect(dragRect);
[self unlockFocus];
}
}
Also I modified the mouseDragged method adding [self
display];
otherwise the display method would never been
invoked.
You should call setNeedsDisplay: instead...
[self setNeedsDisplay:YES];
__________________________________
Do you Yahoo!?
Yahoo! Calendar - Free online calendar with sync to Outlook(TM).
http://calendar.yahoo.com
_______________________________________________
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.
--
|\ /| email@hidden
http://www.marco-binder.de
| \/ | Telefon: 07531 / 94 19 94 Fax: 07531 / 94 19 92
| |ARCO Snail-Mail: Banater Str. 3 - 78467 Konstanz
BINDER _____________________________________________________
_______________________________________________
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.