Code Monkey home page Code Monkey logo

Comments (10)

timthedevguy avatar timthedevguy commented on July 17, 2024

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.

from bghudappkit.

frankrei avatar frankrei commented on July 17, 2024

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.

from bghudappkit.

frankrei avatar frankrei commented on July 17, 2024

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.

from bghudappkit.

timthedevguy avatar timthedevguy commented on July 17, 2024

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.

from bghudappkit.

AlexanderWillner avatar AlexanderWillner commented on July 17, 2024

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

from bghudappkit.

timthedevguy avatar timthedevguy commented on July 17, 2024

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

from bghudappkit.

AlexanderWillner avatar AlexanderWillner commented on July 17, 2024

Interesting. This is my video: http://dl.dropbox.com/u/1358485/bugs/pomodoro/ScreenRecording.m4v

from bghudappkit.

frankrei avatar frankrei commented on July 17, 2024

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?

from bghudappkit.

AlexanderWillner avatar AlexanderWillner commented on July 17, 2024

Do these screenshots help?

http://dl.dropbox.com/u/1358485/bugs/pomodoro/screenshot1.png
http://dl.dropbox.com/u/1358485/bugs/pomodoro/screenshot2.png

from bghudappkit.

timthedevguy avatar timthedevguy commented on July 17, 2024

Closed

from bghudappkit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.