Disable certain cxRadioButtons inside a dxCheckGroupBox - delphi

I have a dxCheckGroupBox with 5 cxRadioButtons inside.
Check box of the dxCheckGroupBox toggles it's state (cbaToggleChildrenEnabledState) from enabled to disabled.
How can I disable certain cxRadioButtons inside dxCheckGroupBox so they stay
disabled when I click the dxCheckGroupBox's check box ?
I tried disabling the buttons by code in the OnFormShow event but it does not work.
As soon as I click dxCheckGroupBox's check box they all get enabled.

Set the CheckAction property of the dxCheckGroupBox;
dxCheckGroupBox1.CheckBox.CheckAction := cbaNone;
You'll be able to disable/enable controls.

Related

iOS: UIAccessibility (Voice Over) with checkbox is not working properly

I am using voice over on checkbox.

The issue I am facing here is,
when user selects the checkbox for the first time it says 'checkbox selected' (which is correct as per accessibilityLabel set) but next time when user tries to de-select it says 'checkbox selected, checkbox de-selected' where it should only say 'checkbox de-selected', vice-a-versa.

So what is happening here is that, the previously set accessibilityLabel is not getting cleared up and when user tries to select or de-select it takes the both previous and currently set label.

Note- using custom checkbox, toggling UIButton with selected/de-selected image.
How to solve this conflict? 
If you create your checkbox thanks to a UIButton item, I suggest to :
Untick the button UIAccessibilityTraits.
Provide a clear hint when the checkbox is first selected : "double tap to change the value".
Update your button accessibility label thanks to IBAction when the box is toggled.
However, it's always better to create a UIAccessibilityElement that contains your check box and a label that describes what it refers to ⟹ when you double tap this accessible wrapper with one finger, the checkbox value toggles and your initial problem disappears.
Following these steps will provide an appropriate user experience with no checkbox VoiceOver conflict that you noticed.

TToolbar Button with dropdown menu greyed out

I'm having issues getting a TToolbar Button to appear "enable"
The button has an Action assigned to it - which is fire by the OnClick event
It is also setup with a Drop Down Menu, which has 2 options on it, both of which are enabled, and both of which fire off when clicked.
Despite all this the TToolbar Button steadfastly remains greyed out, but accepts the clicks.
Any suggestions?
You're doing things wrong. :-)
When using actions, you don't use the button's OnClick event - you put the code in the action's OnExecute event instead (because that's what's executing - the action - and not the button). When an action is assigned to the control, the control cannot be enabled until there's a handler for the TAction.OnExecute.
The reason for using actions is so you can put the code in a single place (events related to the action), and then every single control attached to that action uses that common code to perform the same functionality. Editing the code in that single location means all controls attached to that action see the same changes.
If there's nothing attached to the TAction.OnExecute event, the control has nothing to do if it was selected (clicked), and so there's no reason to enable it in the first place.
In case someone else comes across this, I just had this problem (using Delphi 10.2 Tokyo).
For some reason, the "EnableDropdown" property on the TToolButton caused the button to to be greyed out when set to true. Setting this property to false seems to have resolved the problem for me (the dropdown menu remains functional anyway).

Disable keyboard shortcut (delphi)

I created a form in Delphi.
Say I have a Form with a speedbutton with label "&Add" (underline A, as a keyboard shortcut), and a dbgrid (read-only state) (or other control like TButton).
Then I changed the focus to Dbgrid (dbgrid got a focus) (or to TButton).
Every time I press the a key on the dbgrid, the onClick method on the speedbutton triggers.
Sometime I need to disable it for a while for a reason, and then i enable it again.
How to disable the speedbutton shortcut?
And then how to enable it again?
The form is pressing the button when you press A because the button has expressed interest in that key, and nothing else on your form is accepting keystrokes. If you had an edit box on your form, and it had the input focus, then the button would not be triggered.
You can make a control indicate that it wants to receive keystrokes when it has the focus, but that generally happens when writing a custom control, where you have some idea of what the new control class should do when it receives keyboard input.
If you don't want the button to be triggered, you can disable it. Another option is to alter the OnClick event handler to check other conditions (such as whether the grid has focus) before performing the usual click-handling code.
You could disable the shortcut by changing the speed button's label from &Add to Add. Change it back when you need to enable the shortcut again.
Please note that specifying an accelerator character like that enables two shortcuts, one is just the key prefaced with the & and the other the same key with Alt. So, in your case they would be A and Alt+A. In the same way, eliminating the accelerator disables both shortcuts. So, keep in mind that with this method of disabling the shortcut you would be unable to trigger the button neither with A nor with Alt+A.

Make a JQuery disabled button enabled with proper styles

I have a JQuery Button, disabled by default and I need to enable it on certain event.
My problem is that when I just simply remove the attribute 'disabled' the button maintains the disabled jquery css styles.
I removed them by hand:
$('[id$=btnDowloadXLS]').removeAttr("disabled").removeClass("ui-state-disabled").removeClass("ui-button-disabled");
But, then the button is not the same as an active button, onMouseDown it doesn't take the proper style.
I figured out this solution
$('[id$=btnDowloadXLS]').button({ disabled: false });
which I think creates again the JQuery button.
My question is: is there a cleaner, proper way to re-enable a button and that the button gets the proper/by-default enabled styles?
jQuery UI buttons have enable and disable methods that you can call to enable or disable the button:
$("#mybutton").button("enable"); // or .button("disable");
Check the Methods tab of the documentation:
.button("enable");
If you want to toggle it using a Boolean (e.g. enabled), this should also work (documentation):
.button("option", "disabled", !enabled);

FF addon toolbar, how do you allow items to be dragged onto it?

FF addon toolbar, how do you allow items to be dragged onto it?
You should read the Drag and drop documentation.
Basically you have to listen to the dragenter event:
dragenter
Fired when the mouse is first moved over an element while a drag is occuring. A listener for this event should indicate whether a drop is allowed over this location. If there are no listeners, or the listeners perform no operations, then a drop is not allowed by default. This is also the event to listen to if you want to provide feedback that a drop is allowed such as displaying a highlight or insertion marker. For information about this, see Specifying Drop Targets.
Actually the correct answer is: adding customizable="true" to the toolbar tag will allow you to drop icons onto your toolbar.

Resources