|
|
Making window ignore clicks completely
|
|
|
|
Dedicated MacNNer
Join Date: Apr 2004
Status:
Offline
|
|
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?
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
Is the app below the window Cocoa or Carbon?
See this thread.
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Apr 2004
Status:
Offline
|
|
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...
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
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];
|
|
|
|
|
|
|
|
Dedicated MacNNer
Join Date: Apr 2004
Status:
Offline
|
|
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?)
|
|
|
|
|
|
|
|
|
Senior User
Join Date: Nov 2001
Location: State of Denial
Status:
Offline
|
|
No, since frameworks are dynamically linked. It'll use whichever version the user has on their machine.
|
[Wevah setPostCount:[Wevah postCount] + 1];
|
|
|
|
|
|
|
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
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 Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|