How do I set the state of a three-state checkbox? - checkbox

I am using AutoIt to automate a Windows application for testing. I would like to be able to set the state of a three state checkbox that is by default indeterminate.
I have tried using ControlCommand(.., .., .., "Uncheck", ..) to set the "unchecked" state but it remains at indeterminate.
When I use "Check" in ControlCommand it moves the CheckBox from Indeterminate to False because that is the order of clicks:
Indeterminate
Unchecked
Checked
Is there a way to set the state programatically using AutoIt, without assuming the default state and counting the number of clicks myself?

A Checkbox is in fact a special version of a button. Don't ask why, it's MS and they thought that was a good idea.
You can do exactly what you want using the _GUICtrlButton_SetCheck function, there is an example in the helpfile here:
_GUICtrlButton_SetCheck($idChk, $BST_INDETERMINATE)

Related

Incorporate dropdown and dialog together in React Typescript

I am new to react and need your help.
I have a dropdown and on selecting a value I am checking if selected value is not meeting a condition I need to prompt a dialog box to user if he wants to continue to go with the selection,if he selects yes then selected value to be saved in database.
On select and on selecting yes are two callback functions. My query is how to set the state for current selected value during OnSelect callback so that I can make it available within OnSelectYes also.
You should look into https://react-select.com/async
Will make it easier to make this select component that you want.

Dynamic radio/checkbox solution in Aurelia

I have a gist demonstrating my problem here:
https://gist.run/?id=e2ccd5925e383f2fc36ad277c31bcf23
The checkbox version works fine, if you remove a check, it updates the model right, but if you change the selected radio button, it will keep the true value on the radio that got it's selection removed. If I remove the model.bind="true" value, it will write "on" instead of true. I do want true/false, and not on/off.
I want the object to get it's property updated to be a true or false depending on if it's chosen or not, dynamically. In my scenario I don't know how many radio buttons or checkboxes will need to be selected. I only know that in the cases of it not being a collection, I only want one, and in the case that it is a collection, I want an unknown number selected.
Like the other answer mentions - <input type="checkbox"> behavior is different from <input type="radio">.
I have forked your gist and made the following changes to make your scenario with the radio button work in aurelia:
1) Added a function to the first object in your params collection called selectedChanged(it doesn't have to be there, could be on the viewmodel class instead, perhaps a better place for it). It is responsible for handling selection change in the radio button group, specifically it will iterate over a collection of options (second parameter), and set selected property to true on the option who's id matches the first parameter of the function, and to false on all other options.
2) There is an event on the input called change, I delegate it to a function called selectedChanged mentioned above, passing the option.id value and options as parameters.
https://gist.run/?id=5f38414fde799dfc145fc1291d9f2fd3&sha=f12283b08bfb45e77b8280d46a3709b6ccb82768
I think what you want to achieve (turning individual value on/off) is not achievable with radio, as the way it works (select a single value out of a set) is different with check-box (turning individual value on/off) (MDN reference). So If you truly want to have radio like appearance, with check-box behavior, consider employing some CSS and extra DOM elements to make it look like so, and behave like so.

Checkbox with initialValues of true is being displayed without check on refresh

I am seeing this in Edge and IE.
I have a checkbox which is being initialized using initialValues to true.
On first visit its is displayed correctly as checked with a value of true, however after refreshing the page via the browser, the checkbox is not checked but still has a value of true. As i can continue to refresh the page the checkbox continues to switch in this way checked then unchecked on next refresh. redux form 7.2.3 react 15.6.2.
Thanks
The value of a checkbox is what will be associated with its name if it is checked. Checking a checkbox should not change the value, it should change the checked property.
This is not specific to redux-form, it is just how form elements are intended to work. It looks like redux-form wants to use value instead, and it doesn't work right.
In any case, I think you want to specifically handle the checked property with something like checked={value}.
Roy's answer is correct. Adding some redux-form context, passing checked to a Field component will override the normal behaviour. The normal behaviour is to compare if the value stored in redux-form's state is the same as the value prop specified on Field if so the checked prop is true.
So for example if the store state is values: { test: true } and your Field has value={true} then the end result is the checked prop is true.
The F5 refreshing toggle most likely suggests that your values initialization is changing on each refresh. It's hard to help you beyond a general statement like this without clear reproduction steps.

Default value for ExtJs Combo box without using emptyText

I'm using ExtJs 4 and in my Web application I have a combo box. Previously I used to set the default value of the combo box using emptyText. It works just fine. But, is there any alternative way of setting the default value for the same?
I looked into different questions here on SO and tried the following -
Ext.getCmp('myComboBoxID').setValue("myValue");
However, this doesn't seem to be working. I also tried the simple value attribute to no avail. How can I the set the default value other than using emptyText?
Also, when the value is set using emptyText, it is displayed in gray color (which is poorly vsible), I was wondering if one can work with the opacity of the ExtJs select box?
Update: I used Ext.getCmp('myComboBoxID').setRawValue("myValue"); to set the value & it worked. What is the difference between setValue() & setRawValue()?
You need to supply the id to getCmp method. Try the following.
Ext.getCmp('#myComboBoxID').setValue("myValue");
I used Ext.getCmp('myComboBoxID').setRawValue("myValue"); to set the value & it worked.
The store needs to be loaded before you call setValue and you use the id of the record you want to select. There is a load event you can listen for if the values are loaded from the server. emptyText is not intended for default values, but to help the user understand what should be done with the field (eg "Select a state" from a list of states)

Indeterminate state in Checkbox/ToggleButton changes to Unchecked on mouse over

I have a threestate RadioButton (same issue with ToggleButton) with a custom template in WPF (using Blend 4.0) and I turn it to 'Indeterminate' state on Load. This works fine, and I want to keep it in that state till the user clicks it. The problem is it changes to Unchecked state as soon as the user puts the mouse over it.
How can I prevent this unwanted change of state from happening? Is this the default behavior or something I might have changed accidentally?
I also would like that after clicked it would chang directly to the 'Checked' state but that's a different question and I've read it might have to do with changing the order of states.

Resources