Closed adib closed 14 years ago
Currently there is no work around, this was a skeleton of my work in getting BGHUDStepperCell to work, but ran into some issues subclassing it, namely detecting up/down clicks in the cell.
Thanks
I think you may need to override these methods:
- (BOOL)trackMouse:(id)fp8 inRect:(struct _NSRect)fp12 ofView:(id)fp28 untilMouseUp:(BOOL)fp32;
- (BOOL)startTrackingAt:(struct _NSPoint)fp8 inView:(id)fp16;
- (BOOL)continueTracking:(struct _NSPoint)fp8 at:(struct _NSPoint)fp16 inView:(id)fp24;
- (void)stopTracking:(struct _NSPoint)fp8 at:(struct _NSPoint)fp16 inView:(id)fp24 mouseIsUp:(BOOL)fp28;
You could use these to track where the mouse started and ended, thus detecting when it is down/out/in/up, etc.
-(BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
NSLog(@"start at: %@",NSStringFromPoint(startPoint));
return [super startTrackingAt:startPoint inView:controlView];
}
-(BOOL)continueTracking:(NSPoint)lastPoint at:(NSPoint)currentPoint inView:(NSView *)controlView
{
NSLog(@"continue at:%@ new: %@",NSStringFromPoint(lastPoint),NSStringFromPoint(currentPoint));
return [super continueTracking:lastPoint at:currentPoint inView:controlView];
}
-(void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag
{
NSLog(@"stop with last: %@, stopPoint: %@",NSStringFromPoint(lastPoint),NSStringFromPoint(stopPoint));
[super stopTracking:lastPoint at:stopPoint inView:controlView mouseIsUp:flag];
}
These all work. They track properly. It should be trivial to change the image based on the position of the point inside the view. All you should need to do is the drawing. The superclass should handle all the rest for you just fine.
Thanks to Sastira BGHUDAppKit now has a working StepperCell!
Apparently the drawWithFrame: method of BGHUDStepperCell isn't implemented yet -- currently it only draws a red rectangle instead of a black stepper cell.
Is there any workaround?
Thanks.