Thursday 15 September 2011

objective c - Receive global TouchEvents with NSEvent -


I try to get worldwide touch events in the window and not only in one view in my code, You can see, I get full touch of touch in the magic trackpad. As long as the cursor is inside the scene (Red NSRact) works fine, but how can I get touch out of this scene? I searched for solutions in many communities and apple developers but found nothing. I think the problem is: NSSet * touches = [ev touchesMatchingPhase: NSTouchPhaseTouching inView: zero]; Is there no way in NSEvent, which is every touch?

Anybody can hope to help me.

My implementation here:

  @implementation MyView - (id) initWithFrame: (NSRect) frame {self = [super initWithFrame: frame]; If (auto) {// the initial code is here [Self Set Exceptions TouchAvent: Yes]; MyColor = [Enclosure color with deviation: 1.0 green: 0 blue: 0 alpha: 0.5]; } Healthy return; } - (Zero) Direct: (NSRact) dirty undressed {// here the drawing code. NSRact bound = [self limit]; [Mycolor set]; [Nsbz; pear-frontect: border]; } - (zero) touchesBegan with event: (nscit *) ev {NSSet * touches = [echoing touching face: NSTouchPhaseTouching inView: zero]; (NSTouch * to touch in touch) {NSPoint fraction = touch. Generalized status; NSSize whole = touch. Device size; NSPoint whole inch = {full. Wide / 72.0, complete. Heights / 72.0}; NSPoint pos = wholeInches; Pos.x * = fraction.x; Pos.y * = fraction.y; NSLog ("% s: Finger is touching"% "right and% g inch above the lower left corner of trippad.", __func__, pos.x, pos.y); }}    

calling

touching face: invoice: with Zero for the last parameter (the way you are doing) touch all. The problem is that touching algebra: will not just be a control which is not in the touch zone.

You can see the answer first, which will send all the events first to see it and

No comments:

Post a Comment