Closed frankrei closed 13 years ago
Test your code using standard controls, I'm pretty sure you will have the same issues, I've found that checking Auto Recalculate in the Window settings doesn't always work as expected. Do a manual recalculate. The reason I say try this with normal controls is because BGHUDAppKit doesn't do anything to the function of the controls, just the appearance, so please let me know if your test fails, that way I can figure out why behavior is being modified and not just appearance :)
But to answer your question in quick words, yes, BGHUDAppKit should maintain all functionality of the original apple counterparts.
I've checked and the actual problem is that the controls do not draw a "focus ring". Ie. the controls are fully functional but do not show that they are selected.
So when the user tabs through the controls it looks like nothing is happening. Actually pressing the "space" key to activate the control activated the control; the key loop is fine.
I think all you need to do is to draw the focus ring around the button in in the drawRect method if it is the first responder.
The focus ring is only displayed if the "All Controls" radio button is selected in the "Full Keyboard Access" section of the "Keyboard Shortcuts" tab of the "Keyboard" System Preferences.
I've had a look in the source code and it seems that the problem is simply that no focus ring is being set in the -(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView method of the BGHUDButtonCell class. Just adding the call seems to produce ok-ish results:
-(void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
// Make sure our own height is right, and not using
// a NSMatrix parents height.
cellFrame.size.height = [self cellSize].height;
[NSGraphicsContext saveGraphicsState];
if([super showsFirstResponder] && [[[self controlView] window] isKeyWindow] &&
([self focusRingType] == NSFocusRingTypeDefault ||
[self focusRingType] == NSFocusRingTypeExterior)) {
[[[[BGThemeManager keyedManager] themeForKey: self.themeKey] focusRing] set];
}
switch ([self bezelStyle]) {
case NSTexturedRoundedBezelStyle:
[self drawTexturedRoundedButtonInFrame: cellFrame];
break;
case NSRoundRectBezelStyle:
[self drawRoundRectButtonInFrame: cellFrame];
break;
case NSSmallSquareBezelStyle:
[self drawSmallSquareButtonInFrame: cellFrame];
break;
case NSRoundedBezelStyle:
[self drawRoundedButtonInFrame: cellFrame];
break;
}
if([[_normalImage name] isEqualToString: @"NSSwitch"] ||
[[_normalImage name] isEqualToString: @"NSRadioButton"]) {
if([self imagePosition] != NSNoImage) {
[self drawImage: [self image] withFrame: cellFrame inView: [self controlView]];
}
}
[NSGraphicsContext restoreGraphicsState];
}
I haven't played around a lot with it yet but it certainly makes the focus visible even if it turns out that there is still room for a bit of fine tuning in the drawing.
I hope this helps.
Sure does, I'm currently in the process of changing how BGHUDAppKit draws things, I tried to draw everything within it's own bounds, afterwards I found out that alot of the specular effects, focus rings, shadows and whatnot are actually drawn in the parent view.
Based on my experiences with https://github.com/ugol/pomodoro/ BGHUDAppKit does not support keyboard shortcuts like cmd+c or cmd+v - see https://github.com/ugol/pomodoro/issues/issue/102
Alexander,
Not sure why it doesn't on your end. Works fine on my end, I made no changes to any part of the function of the control, only the drawing.
See this vid as example: http://www.binarymethod.com/Works.mov
Interesting. This is my video: http://dl.dropbox.com/u/1358485/bugs/pomodoro/ScreenRecording.m4v
Just a thought.. in the video you can't see the menu bar. The Command-C/ Command-V behavior relies on the items being defined in the Edit menu and connected to the first responder. You haven't deleted or "disabled" these items in any way?
Closed
Hi,
I'm having some issues where the keyboard loop (tabbing between different buttons) seems to be broken even if "Full keyboard access" switched on.
It could just be my code, but usually the "automatically recalculate keyboard loop" feature does an okay job at wiring up everything correctly.
My question: "Is BGHUDAppKit" fully keyboard accessible like the standard Mac OS X buttons and controls? If not what needs to be done to get it to work?".
Thanks for making this cool framework available.