cancel
Showing results for 
Search instead for 
Did you mean: 

Extending radio button to include text label?

Is it possible to have a text label associated with a radio button, such that either may be clicked to select it?

8 REPLIES 8
Martin KJELDSEN
Chief III

A RadioButton is actually just a Button (which inherits from AbstractButton). It is when you add the RadioButtons to a RadioButtonGroup that they work together. Check out these classes and see if you can get inspired to do what you want.

/Martin

Currently I have static text fields next to each radio button to give context in Designer. The radio button images are small and fiddly to select. I know it's possible to have ClickListener mixins to text, but this feels overcomplicated. Is the only way to associate a selectable text label with the radio button by extending the RadioButton class? Would this still work if the radio buttons are added to the screen in Designer? I'm surprised this isn't a common thing to need, as radio buttons on their own convey no meaning to the user.

Martin KJELDSEN
Chief III

​Currently you can't choose a text to be your Radiobutton clickable, but i'll take it as input. So yes, you'd have to extend the RadioButton class but you won't be able to use that from the designer, so you'd have to configure things in the concrete view classes (in gui/). For now. 🙂

OK thanks. It would be great if the designer could be configured to generate code using user-extended widget classes.

Would it be possible to have a roadmap of if and when requested features and upcoming changes will be added to the designer? I know it's been asked for in the Idea Zone https://community.st.com/s/ideazone?t=1604315637197#list

Martin KJELDSEN
Chief III

The part about allowing the designer to use custom classes is something i think is a good idea, so you're not forced to do everything in user code, away from the help of the designer.

Martin KJELDSEN
Chief III

>Would it be possible to have a roadmap of if and when requested features and upcoming changes will be added to the designer? I know it's been asked for in the Idea Zone https://community.st.com/s/ideazone?t=1604315637197#list

Regarding this, i'll try to follow up on it. Generally, when we lock features in for a release then they should be final, so it might be possible to make that list public. Of course things happen such that some things don't make it, but for larger features it would be a good idea to have an open road-map that users can follow.

/Martin

Thanks, that's fair enough that some features may be tentative, or take longer than expected. I think it will help decide to holdoff doing something in user code, and also with adoption of the TouchGFX framework in general. I will add a request in the idea zone for custom classes.

Martin KJELDSEN
Chief III

​That's great, thanks.