Cocoa radio buttons disappear when clicked - cocoa

I have a window with two radio buttons. When I click one of them, both disappear. The "selected" highlight remains. If the windows looses focus and I switch back, the buttons return, only to disappear again when I click one of them.
I'm quite lost, I don't even know where to begin. Do you have any suggestions?

Related

Firemonkey TComboColorBox hiding color picker

Is there a way, after selection of a color, to programmatically hide the color picker of the TComboColorBox? I've searched on the web and Embarcadero community but couldn't find a way to do this.
The answer is no, there is no designed way to hide (collapse) the popup programmatically. And you did not explain why you think it would be necessary to have.
Keep in mind that there are 4 subcontrols, that the user may want to use:
a THueTrackBar,
an alpha channel trackbar,
a color quad, and
a hex color value edit box.
An automatic collapse of the popup would be just annoying.
The user can at any time decide to close the popup simply by clicking on the constantly visible bar.
With reference to your comment:
After your answer, I realized that I must implement a color picker component that shows a rect containing a TComboColorBox and a TButton as childs. Clicking the child button, in turn, hides the container rect itself.
I have told you twice that the user can close the popup part of the TComboColorBox simply by clicking on the component (the base part of it).
In fact, the user can click anywhere outside of the popup window in order to close the popup window. The popup is closed immediately when the focus moves away from it.
In my opinion there's no need for a special "Close" button.

Button not showing in .nib file

So I downloaded CircleView and tried to change the code. The program came with a button, color wheel, 2 sliders, and a view. When ever I add anything (Slider, button, textfield), on run time the things I added wouldn't show up. What am I not doing?
It's a .nib file.
This is the edit page.
This is what I see when running the program.
As you can see, the button and textfield doesn't appear during run time.
By default, when you add a button, the autoresizing mask (aka "springs and struts") are set to the following:
That means that when you resize the window, the button you added will stay in the same spot it originally was, instead of being "pulled" down with the edge of the window. This could potentially cause the buttons or textfields you added to be hidden behind the circle view once you resize the window large enough.
To prevent that from happening you'll want to change the autoresizing mask of the items to be "pinned" to the bottom edge of the window, so that they look like in the following image:
To do that, click on the red I bar at the top of the square to remove it, and then click on the lower I area to turn it on.
Note that you can also select multiple buttons or textfields at one time to change them all at the same time.

svg groups with animation and mouseout trigger

I have an issue with svg groups and basic animation. this guy is a button. When hovered over, out pops a sort of menu. The goal is that the menu retracts when the mouse pointer leaves the button and the menu.
The trouble starts with 'onmouseout'; even though button & menu are grouped, and with 'onmouseout' acting on the whole group, the mouseout action is triggered by mousing out ANY element within the group. So a move from button to menu triggers the retraction.
To work around this I've put a mask over the top that appears (so to speak - it does become visible but has 0 opacity, so cannot be seen), when the button is moused over. I've turned it grey here so you can see it. But if i want to add element onto this menu, I'm no further forward than before. The red block is this other element.
Seemingly, if I had the menu just appear instead of using animations to make them appear, the groups would behave as I want them to.
I hope someone can help or shed some light.

Why do my buttons stay highlighted simultaneously?

You usually only have one button that looks like a "default button".
However, I made a child window and placed two buttons in it (with the child window as their parent). Then I put the child window inside a dialog and displayed it.
Suddenly, the buttons stay highlighted even when I click other buttons!
Why?
Your child window needs the WS_EX_CONTROLPARENT style, to allow the dialog to handle the notifications from its children.

How do I stop my NSbutton from being selected when the app starts by default?

I created a button, and a have a little problem: When the my app launches, the button is selected. How do I disable this selection?
Example:
Caveat: This answer is incomplete: It just hides the focus ring (without preventing the selection). There's little benefit in this solution.
Set your button's focus ring type to none:
[myButton setFocusRingType:NSFocusRingTypeNone];
You can also set this option in the XIB.
First, you should know that, by default, buttons can't get focus. A user would have to have selected System Preferences > Keyboard > Shortcuts > Full Keyboard Access: All Controls. If they've done that, they may want a button to initially have focus.
Anyway, the proper way to do this is to call [theWindow makeFirstResponder:nil] sometime after showing it the first time. When to do this depends on exactly how the window gets shown. If you show it explicitly in code, then you can make the call just after that. If it's shown because its Visible at Launch flag is set in its NIB, then you'd do it after the NIB is loaded. Etc.
Something should always be first responder in a window, if anything can be. Normally, only a few controls like text fields can become first responder, but when a user has Full Keyboard Access enabled, it's normal for a button to be selected by default.
If you don't want this particular button to start selected, set the window's initialFirstResponder to another control.
I'd advise against using -[NSWindow makeFirstResponder:nil]. The window will start with nothing selected, but the button will become selected as soon as the user hits tab. This is unusual for Mac apps because there's no way to get the window back into the "nothing selected" state as a user.

Resources