mouseDown/Up on window's titlebar?
mouseDown/Up on window's titlebar?
- Subject: mouseDown/Up on window's titlebar?
- From: Ken Tabb <email@hidden>
- Date: Mon, 31 Jan 2005 18:03:04 +0000
Hi folks,
I need to detect mouseDown / mouseUp / mouseDragged events on a
window's titlebar - I'm implementing sticky windows (snappable
palettes). These events are sent correctly when the mouse is in the
content view, but not in the window's titlebar... mouseDragged is sent
but not mouseDown / mouseUp.
I could set my window subclass as it's own delegate so that it receives
the -windowWillMove and -windowDidMove notifications, which roughly
speaking mimic mouseDown / mouseUp in terms of indicating the mouse
state, however there are some circumstances when they don't work
reliably enough for my needs.
For instance if a user clicks in the titlebar, you get a windowWillMove
(similar to mouseDown) prior to any dragging events. However if the
user doesn't actually drag, and lets go in the same location (i.e. if
they single click the titlebar) you don't get the -windowDidMove
(equivalent to -mouseUp) because the window didn't actually move.
Furthermore if you click on the titlebar and drag it, keep the mouse
down, then drag it again somewhere, keep the mouse down, then drag it
again somewhere, you get 1x -windowWillMove (the initial mouseDown
click) and 3x -windowDidMove's, one for each hesitation / final resting
place in the drag. Which makes sense, but it also means it isn't a
reliable substitute for a working mouseDown / mouseUp.
So is there any way to get mouseDown/mouseUp events on the window's
titlebar? Specifically:
[1] Would overriding my window's -sendEvent method help or does the
window server not send those events anyway?
[2] If I made the window without an Aqua titlebar and then made my own
titlebar programmatically (views, textfields etc.) would this help me
get the events (as the titlebar, to Cocoa, would then be part of the
window's contentView, even though to you and I it looks like a
titlebar). Granted this is a pug ugly way of doing it, prone to
breaking the minute Apple slightly modify the Aqua appearance, but if
this is the only way it works...
Thanks in advance for any help you can give,
Ken
- - - - - - - - - -
Dr. Ken Tabb
Mac & UNIX Developer - Health & Human Sciences
Machine Vision & Neural Network researcher - School of Computer Science
University of Hertfordshire, UK
http://www.health.herts.ac.uk/ken/
Certified non-Microsoft Solution Provider
_______________________________________________
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