Re: Creating the illusion of a full featured window
Re: Creating the illusion of a full featured window
- Subject: Re: Creating the illusion of a full featured window
- From: Glenn Zelniker <email@hidden>
- Date: Thu, 10 Feb 2005 17:38:36 -0500
On Feb 10, 2005, at 07:27 AM, Martin Hering wrote:
Hi,
I am currently creating subclasses of nearly all AppKit controls, views
and windows to have my applications in a unique style. So I created a
subclass of NSWindow, made it borderless and drewed it in my own style.
Works fine. But now I want to make the window movable and not by the
complete background but only when the mouse clicks on a certain
area of the window, like in the normal window title bar. How can I
accomplish that? Do I have to catch some events?
You can do it with an NSTrackingRect or you can subclass an NSView (say
you call it MyView) and put an instance of this view in your window,
where you'd like the window to be clicked and dragged. Then you can
override the -mouseDown and -mouseDragged methods in your MyView class
and use the differential between the location of the event (i.e.,
[event locationInWindow]) reported by -mouseDown and the event reported
by -mouseDragged and use this differential to redraw your MyView's
superview -- i.e., the window you're trying to move.
HTH,
Glenn Zelniker
_______________________________________________
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