I added toggle buttons on the access form like (YES or NO). How to save a value in the table, pressing on the respective buttons - vba

I added toggle buttons on the MS ACCESS 2016 Form like (YES or NO). How to save a value in the table, pressing on the respective buttons and one more action is required, when I press the button change the colour (YES - "GREEN", NO - "RED"). Please help me with this.
enter image description here

Create an option group with toggle buttons, not separate buttons. You can bind the option group to the field in database, it will show selected and saved option.
You can adjust pressed color for each of buttons separately, so select green color for background of Yes button and red for No
If you need 3 state options (both not pressed, pressed Yes, pressed No), create option group with 3 buttons, default is neutral and make neutral button invisible

Related

How to handle height of keyboardaAvoidView

I am using keyboardaAvoidView tag and i have one button and one text input box above keyboard but when I click on input box the button gets hide, but I don't want that button to hide, is it possible to set keyboardaAvoidView fixed height so that the button is not getting hide

Change focus on a Button in a Panel using the arrow keys

Assume you have a Form with ten Buttons on it, with the first one having the focus, so that it can be clicked by hitting the Enter key on the keyboard. Now, you can set the focus to the next button simply by pressing the Down arrow key. This works out of the box.
Then I constrain this functionality to the first three Buttons on the Form.
So, when the third Button on the Form has the focus and I press the Down arrow key, the first Button - instead of the forth button - should receive the focus.
Question:
how can I change the focus to another button outside the Panel with arrow key?

OSX: Move keyboard focus between textfields and buttons using tab key

I am trying to toggle between textfields and buttons on my view using keyboard's tab button. The switching between textfields work but it does not switch between buttons. The view is shown as below.I did not find enough resources online to proceed further. Does anyone know how to resolve this?
There is nothing you can do with that issue.
It turns out that in the System Preferences > Keyboard > Shortcuts there is a checkbox, where you can change behaviour of the whole system:
To move keyboard focus only between text boxes and lists
To move keyboard between any of controls
And by default first checkbox is pressed.
As an addition. By default, NSWindow assigns an initial first responder and constructs a key view loop with the objects it finds. You can also change key view loop by calling this method: setNextKeyView.
For example,
[firstTextBox setNextKeyView:secondTextBox];
[secondTextBox setNextKeyView:secondButton];
[secondButton setNextKeyView:firstButton];
[firstButton setNextKeyView:firstTextBox];
This means that for users who expect moving control focus through all controls, this will work. And for those who have disabled this feature in settings, this won't work.
You can right-click on text field, drag "nextKeyView" and drop on another text field that you want to focus next when user press tab. Look like my picture below:
To add to #mjonka's answer, To move focus between controls is dependent on user's keyboard-shortcuts settings. What could be alternate solution is to just selecting your desired action button in your xib file and setting "Key Equivalent" value field to "enter" key in Attributes inspector as shown below. Same thing can be done for cancel button by setting "Key Equivalent" value to "Esc" key.

Adding A View To An Existing View Programatically

How can you add or replace a view within a view with code? I'm programming for OSX, not IOS.
I am using a drawer that utilizes a custom view. In the custom view I have two boxes, one with a custom set of icons that I want to stay static and another box that has the information related to that button. What I want to do is when a user clicks one of the buttons that the 2nd box view changes to reflect the info for that button.
For example, I have five buttons and the default 2nd box is "Info", if the user clicks the 2nd button in the first box view I want to change the 2nd box to be the "List" box instead while the 1st box with the buttons stays intact.
I'm not sure how this would impact constraints since while the first box is a fixed size, the 2nd box needs to be dynamic so that it fills in the "rest of the space" so that when the drawer size changes with the window size that the 2nd box is taking up the remaining real estate.
Thank you!
I have implemented such a scenario in the past using a tabless NSTabView, and an NSSegmentedControl (for the buttons). The NSTabView has it's -takeSelectedTabViewItemFromSender: action connected to the NSSegmentedControl, using Interface Builder.
In the Connections Inspector, this shows up like so:
This has the effect that the index of the selected NSTabViewItem in your NSTabView will correspond to the index of the selected segment in the NSSegmentedControl.

Group UIButtons to limit "selected" state

I have a row of 5 buttons, of which only one button should be "selected" at once. I call
[button setSelected:YES]
triggered by the corresponding IBAction to set the state of a touched button to "selected".
Is it possible to create some sort of button group where only the latest touched button of the row shows as selected and all others switch back to their "default" state? (kind of like radio buttons)
Is it possible to create some sort of button group where only the
latest touched button of the row shows as selected and all others
switch back to their "default" state? (kind of like radio buttons)
So radiobuttons then? A nice implementation called MNMRadioGroup does exactly that.
However, iOS also includes the native UISegmentedControl object which only allows one section to be selected at a time.