Page 1 of 1

[Feature request] Radiobuttons in spreadsheets

Posted: Sat Sep 18, 2021 9:25 pm
by esr
I'm designing a drilling jig to support vintage Model M keyboards that may need to be scaled to two different sizes - one for an M101 and another for an M122. It is fully parametrized, but at the moment one needs to poke in the base dimensions by hand, which is error-prone.

Excel and other spreadsheets have a radiobutton feature that allows selection among exclusive alternatives to set the value of a cell. If I had something like that, I could at least in principle set up my parameter spreadsheet to have an M101 vs. M122 radiobutton group. This feature would of course be very useful whenever it is required to set up one of multiple discrete variants of a parametrized part.

I do *not* suggest emulating Excel's UI for radiobuttons as that interface seems to me to be baroque and overcomplicated. Instead I think the ideal way to design this would be to give spreadsheet cells a radiobutton property that is string-valued. A cell with this property displays a radiobutton graphic instead of its content and becomes part of the radiobutton group named by the property. The state of a radiobutton's indicator is on (filled) if the cell value is nonzero, off if it is zero.

Whenever a radiobutton cell is clicked, two things happen: (1) all other radiobutton cells in the group are set to 0 and, (2) this cell's content is set to 1. Initially, if not all cells in a radiobutton group are zero, the one with the highest value is visually set "on" and all others "off".

Of course other cells in the spreadsheet would use these values in expressions - notably in conditionals.

Re: [Feature request] Radiobuttons in spreadsheets

Posted: Tue Sep 21, 2021 11:56 am
by adrianinsaval
see this pending PR: https://forum.freecadweb.org/viewtopic.php?f=17&t=42183
not the GUI you have in mind but it gives you the same functionality (swithcing between diferent sets of variables)

Re: [Feature request] Radiobuttons in spreadsheets

Posted: Tue Sep 21, 2021 2:18 pm
by openBrain
Maybe some inspiration with pure expression : https://forum.freecadweb.org/viewtopic.php?f=8&t=58657 (talking about the application example, not the topic by itself).