Closed Batwam closed 1 year ago
Indeed this is a great simplification of the code. But I liked the 3 functions as an interface. The new, unified function requires far more syntax.
Can this code or a derivation of it be wrapped on 3 separate functions with the same syntax (parameters) as before?
ok, I have created 3 separate functions which then call the generic function. The only thing these functions do as this stage is set the default width which avoids having to define it when calling the individual functions.
We could go further and add some more case specific code into each of the three functions but I see some drawbacks to this:
addDoubleDropDown
, assume that the options for both dropDowns are the same. This would be sufficient in our case but would make the function less generic.Essentially, we can certainly maintain the original syntax but this means that we don't have syntax consistency between the 3 functions which I feel is a bit of a missed opportunity?
Saw the updates. Fine with me 👍
I don't mind the inconsistency between parameters.
Saw the updates. Fine with me 👍
Great!
I noticed the new functions names aren't the same. But the String
part isn't helpful. DropDowns aren't well suited for boolean or numeric types.
Other than that I suppose there's not much else to discuss/add for this PR is it?
That should be it. Please check just in case that the reset button still works and that changing the values does indeed update the settings. If it all works we should be good to go.
No problems on my end as far as I tested.
And in any case I want to push an update with the new changes soon, so it's time to test main
more thoroughly.
Time for the merge!
Thanks again @Batwam!
I didn't manage to slip that one in before the merge!
Anyway, it wasn't directly related to the reset button anyway. I never felt liked the way we have 3 functions doing essentially the same thing so I thought that it would be a good idea to combine
addDropDown()
,addDoubleStringDropDown()
andaddTripleStringDropDown()
into a grand unified function. I also simplified the code within the addDropDown to avoid repeated code in the process. All in all, this removed 60+ line of duplicated code...