it feels like i'm missing something
in the class that listens for an event i just did this:
where Constants is a custom class
so that makes the class listen for the notification
the method that posts the notification is like this:
printf("right\n");
NSMutableDictionary* info = [NSMutableDictionary dictionary];
[info setValue: [NSValue valueWithPoint: dragStartPoint] forKey: [Constants dragPointStart]];
[info setValue: [NSValue valueWithPoint: [event locationInWindow]] forKey: [Constants dragPointEnd]];
NSNotificationCenter* nc;
nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName: [Constants viewChangeNote]
object: self
userInfo: info];
this happens when the user lets go of the right mouse button
now in the console "right" is printed out once
but straight after that the method that is assigned to that event (handleChangeView) happens twice
the statements that it prints out print out twice
any idea what i'm missing?
in the class that listens for an event i just did this:
Code:
NSNotificationCenter* nc;
nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self
selector: @selector(handleViewChange:)
name: [Constants viewChangeNote]
object: nil];
so that makes the class listen for the notification
the method that posts the notification is like this:
printf("right\n");
NSMutableDictionary* info = [NSMutableDictionary dictionary];
[info setValue: [NSValue valueWithPoint: dragStartPoint] forKey: [Constants dragPointStart]];
[info setValue: [NSValue valueWithPoint: [event locationInWindow]] forKey: [Constants dragPointEnd]];
NSNotificationCenter* nc;
nc = [NSNotificationCenter defaultCenter];
[nc postNotificationName: [Constants viewChangeNote]
object: self
userInfo: info];
this happens when the user lets go of the right mouse button
now in the console "right" is printed out once
but straight after that the method that is assigned to that event (handleChangeView) happens twice
the statements that it prints out print out twice
right
handleViewChange before: 431.000000 390.000000 after 526.000000 393.000000
handleViewChange before: 431.000000 390.000000 after 526.000000 393.000000
any idea what i'm missing?