Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Disabling click-through for cocoa controls?

Disabling click-through for cocoa controls?
Thread Tools
nickm
Mac Enthusiast
Join Date: Dec 2001
Status: Offline
Reply With Quote
Jul 1, 2003, 07:55 PM
 
The Aqua HIG recommend against click-through for destructive items, yet the buttons I create in interface builder by default support click through.

I'd like to change that, but I don't see any obvious way of doing that except to write a bunch of laborious code to enable and disable controls as a window receives and loses the focus.
     
Uncle Skeleton
Addicted to MacNN
Join Date: Nov 2002
Location: Rockville, MD
Status: Offline
Reply With Quote
Jul 21, 2003, 12:11 AM
 
this is a good question. Anyone know the answer?
     
smeger
Mac Elite
Join Date: Sep 2000
Location: Tempe, AZ
Status: Offline
Reply With Quote
Jul 21, 2003, 03:40 AM
 
Override your control's acceptsFirstMouse: method so it always returns "NO". See [NSView acceptsFirstMouse:].
Geekspiff - generating spiffdiddlee software since before you began paying attention.
     
Michel Fortin
Forum Regular
Join Date: Jul 2001
Location: Qu�bec, Canada
Status: Offline
Reply With Quote
Jul 21, 2003, 07:37 AM
 
Originally posted by smeger:
Override your control's acceptsFirstMouse: method so it always returns "NO". See [NSView acceptsFirstMouse:].
Great, but I have a better solution. I've made a class called MFClickThroughDisabler that you just attach to a control in IB and it disable and enable attached control automagically when the window change state preventing click through and giving the correct visual feedback.

If someone want it, just send me an email.

[edit: typo]
( Last edited by Michel Fortin; Jul 21, 2003 at 08:59 AM. )
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 03:13 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,