How to disable radio button control and enable text - swt

I have a radio control with text package. I need to disable the control for the radio button. But the text should be enabled.
Can any one help?

The SWT radio button (new Button( parent, SWT.RADIO )) is a single control that can be enabled or disabled as a whole only.
Technically, you could use a separate radio button (without text) and a Label with a layout to position them side by side. Now you would be able to control their enablement separately.
However, radio buttons are a common and well-recognized UI elements that you would break by enabling/disabling the button and text differently.

Related

Disable radio buttons contained in Box

I have a set of radio buttons that are placed within a box.
When the user selects an option, these buttons needs to be disabled. I cannot find a relevant property to disable all items within the box.Only option I can find is to set the hidden property.
box.isHidden=true
NSButton inherts from NSControl, which has an isEnabled property. If you want your radio buttons to still be visible but not clickable, use that.

Which checkboxes are selected in MATLAB GUI?

When I want to know which radio buttons are selected in a panel in a MATLAB GUI, I use this line:
ChosenOption = get(handles.OptionPanel, 'SelectedObject');
where OptionPanel is the Tag of the panel where the radio buttons are located.
However, if I want to use checkboxes instead of radio buttons, is there any way to do the same?
Thank you.
You would typically get the Value property of each checkbox to determine whether it was checked or not.
Note that typically with checkboxes any, all, or none of the checkboxes may be selected (in contrast to radio buttons, where typically only a single radio button would be selected at any one time), so you would want to get the Value property of each checkbox separately. There's no equivalent of a uibuttongroup that you would use with radio buttons (although you can of course graphically group the checkboxes in a uipanel).

Sencha Touch/Ext: How to disable a Form inside a Tab Panel (tabpanel) without disabling the Tab

I have a simple Tab Panel (tabpanel) where each Tab is a Form. By default, I want the Form to be disabled (read only), and editable once the user taps the Edit button. By setting the "disabled" config of the form, the Tab is also disabled (cannot tap it).
How can I disable the form while keeping the Tab enabled? I have a couple of solutions to fall back on, but I'm hoping for something cleaner/simpler.
My solutions so far:
Make the Tabs Containers and place the Form inside the Container
Disable at the Fieldset level
My current solution uses the Tab Panel's "initialize" event handler and calls "setDisabled(true)" on each Form Panel.
onTabPanelInitializer: function(component, options){
component.query('formpanel').forEach(function(element, index, array){
element.setDisabled(true);
});
}

TabPanel-like Button style for a regular Button

Is there a way to create a TabPanel like Button out of a regular com.emitrom.gwt4.touch.client.widgets.Button
I mean, TabPanel buttons are used to switch between tabs, and have this "pushed down" effect when a certain tab is selected, as it style blends properly with the TabBar of the TabPanel. I am not after the tab switching function but more on the push button function of a TabPanel button.
With TabPanel buttons are automatically inserted as TabPanel item is inserted. Looking at the code I can see that items are styled with: item.setIconCls(TouchIcons.INFO), so I set my button.setIconCls(TouchIcons.INFO) but the effect is not the same.
For some reason I can't use TabPanel so I just need to have this push button style with regular Button or if there's a PushButton.
Answered here: http://www.emitrom.com/node/313
The Button class does not support this feature. What you could do is use the SegmentedButton class with only one button and setAllowMultiple to true. That should do the trick.
Cheers,
Pat.
Regards.

Is there a way to uncheck all radio buttons in a group? (PyGTK)

Is there a way to uncheck all radio buttons in a group with PyGTK? No radio buttons are checked on startup, so I think there must be a way to return them all to that unchecked state.
I agree with Michael, but for the record this can be done.
One way to do this would be to have a hidden radio button that you could activate, which would then cause all the visible ones to be inactive. Quick n' Dirty example:
import gtk
window = gtk.Window()
window.set_default_size(200, 200)
rb1 = gtk.RadioButton()
rb2 = gtk.RadioButton()
rb3 = gtk.RadioButton()
rb2.set_group(rb1)
rb3.set_group(rb2)
rb3.set_active(True)
hbox = gtk.HBox()
hbox.add(rb1)
hbox.add(rb2)
hbox.add(rb3)
button = gtk.Button("Click me")
button.connect("clicked", lambda x: rb3.set_active(True))
hbox.add(button)
window.add(hbox)
window.show_all()
rb3.hide()
gtk.main()
There shouldn't be. By their nature, a radio button group is a 'pick one of many' type of control. From a human perspective, the idea is that one of them is always selected. The framework really should enforce that, so there really shouldn't be a 'none selected' state for the group. The none-selected state of a radio button group (in frameworks where it's possible) is very confusing to users, because that's not a state that they can get the control into.
If you want a 'none selected' state, I'd say you should add a 'none' element to the group, OR chose a different control type that conforms to what you want to do with it.
Looked it up in the source code and set_active simply simulates a click on the button if the new state is different from the old one. The radio button code then checks to see if there is another radio button in the group active and if not, it refuses to change as you noticed.
From what it looks the first radio button should always be set to active when you create the group (as expected). If it doesn't show it is likely a bug, it would be interested to see if radio_button.get_active is True for the first button you create (even if it doesn't show up in the UI).
I agree with Michael Kohne though that you should look into another UI element if you want to make all the radio buttons unselected.
My solution, which is notably not encouraged, Is to have a radio button in the same group that isn't shown on screen.
In Glade you can 'add widget as toplevel' in the context menu of the widget add button. In code I would imaging it's basically just don't add the widget to any displayed gui, or carefully don't .show() it (including .showall() on a parent)