0
기본적으로 전체 화면을 감추고있는 "보이지 않는"NSView가 필요합니다. NSTrackingArea를 추가하여 커서가 화면에서 움직이는 것처럼 전역 마우스 이벤트를 가져옵니다.NSView에서 창에 연결되지 않은 NSTrackingArea를 사용하고 있습니까?
-(void)setTrackingArea
{
view = [[NSView alloc] initWithFrame:[NSScreen currentScreenForPoint:[NSEvent mouseLocation]].frame];
NSTrackingArea *area = [[NSTrackingArea alloc] initWithRect:[NSScreen currentScreenForPoint:[NSEvent mouseLocation]].frame options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways owner:view userInfo:nil];
[view addTrackingArea:area];
[area release];
//[[window contentView] addSubview:view];
//I don't want to add the view to a window, as all tutorials say.
}
- (void)mouseExited:(NSEvent *)theEvent
{
NSLog(@"Exit"); //Never firing
}
이것이 가능합니까? 창없이 NSViews와 NSTracking Areas 사용하기
,하지만 당신은 보이지 않는 윈도우를 생성 할 수 있어야한다 :
예를 들어, 여기에 마우스의 움직임을 모니터를 추가하는 방법은 그것은 전체 화면을 덮고 있습니다. –