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 > Making window ignore clicks completely

Making window ignore clicks completely
Thread Tools
arcticmac
Dedicated MacNNer
Join Date: Apr 2004
Status: Offline
Reply With Quote
Jul 11, 2005, 12:26 AM
 
I have a window that I'm using to draw on that's completely transparent (except where I've drawn), etc. That's all well and fine, but when you click on the window, it switches to my app, which I'd like to provide an option for it NOT to do. SO, I use
Code:
[window setIgnoresMouseEvents:YES];
which works... sort of.

The thing is, that setIgnoresMouseEvents simply causes the window to beep when clicked... I'd like some way so that not only does it not activate my app, and not only does it not beep, but it passes the click through to whatever is below it.

any ideas?
     
Wevah
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Jul 11, 2005, 08:24 PM
 
Is the app below the window Cocoa or Carbon?

See this thread.
[Wevah setPostCount:[Wevah postCount] + 1];
     
arcticmac  (op)
Dedicated MacNNer
Join Date: Apr 2004
Status: Offline
Reply With Quote
Jul 12, 2005, 12:03 AM
 
Originally Posted by Wevah
Is the app below the window Cocoa or Carbon?

See this thread.
I added this method to my controller:

Code:
-(void)updateWindowClickThrough { void *ref = [window windowRef]; if (clickThrough) ChangeWindowAttributes(ref, kWindowIgnoreClicksAttribute, kWindowNoAttributes); else ChangeWindowAttributes(ref, kWindowNoAttributes, kWindowIgnoreClicksAttribute); [window setIgnoresMouseEvents:clickThrough]; }
clickThrough is an instance variable BOOL set someplace else (wherever it calls [self updateWindowClickThrough]) and window points to, obviously, the window in question. I added the
Code:
#import <Carbon/Carbon.h>
at the beginning, and when I compile, I get this:

Code:
ld: /Users/ben/Programs/buildFiles/MacLampsX.build/MacLampsX.build/Objects-normal/ppc/LightsController.o illegal reference to symbol: _ChangeWindowAttributes defined in indirectly referenced dynamic library /System/Library/Frameworks/Carbon.framework/Versions/A/Frameworks/HIToolbox.framework/Versions/A/HIToolbox
what gives?

oh, and, in case it wasn't obvious, the error occurs while linking...
     
Wevah
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Jul 12, 2005, 12:16 AM
 
You have to make sure to add the Carbon framework to your project, also. Project -> Add To Project..., and it's at /System/Library/Frameworks/Carbon.framework .

HTH (though I can't say for certain that this code will positively do what you want, I think it will).
[Wevah setPostCount:[Wevah postCount] + 1];
     
arcticmac  (op)
Dedicated MacNNer
Join Date: Apr 2004
Status: Offline
Reply With Quote
Jul 12, 2005, 10:06 AM
 
cheers. thanks...

is this gonna make the program a lot bigger to import carbon? (i.e. does the executable size increase because of having two frameworks?)
     
Wevah
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Jul 12, 2005, 05:02 PM
 
No, since frameworks are dynamically linked. It'll use whichever version the user has on their machine.
[Wevah setPostCount:[Wevah postCount] + 1];
     
Chuckit
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status: Offline
Reply With Quote
Jul 12, 2005, 05:11 PM
 
The executable size will increase slightly because of the headers you import, but like Wevah said, frameworks are dynamically linked, not included in the executable.
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
     
   
 
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 10:27 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.,