Consider the following code
Manipulate[c,
Dynamic@Grid[{
{"Checkbox 1",
Row[{Control[{{a, 0, ""}, {1, 0}}],
If[a == 1,
Control[{{c, {0}, ""}, {1 -> "Edit"},
ControlType -> TogglerBar}], Unevaluated[Sequence[]]]}, Alignment -> Left]},
{"Checkbox 2", Control[{{b, 0, ""}, {1, 0}}]}
}, Alignment -> {Left, Right}], ControlPlacement -> Left]
When I check the first Checkbox, I get
As one can see, the alignment between the two checkboxes is now off. Any way to fix this? I tried aligning the Row
and setting Appearance -> None
within the Edit
control, but nothing seems to work.
My goal is to get
Any suggestions/alternative are appreciated.
Edit: Using kglr's solution below, and setting Appearance -> None
in the Edit
control, I still have two issues. One is that even though the additional vertical spacing I get when Checkbox 1 is selected can be neutralised by the extra Appearance
condition, I'd still like to have no horizontal spacing, as seen in the following
Secondly, my code actually has lots of checkboxes and sliders vertically displayed, so this solution would yield a much bigger code and this horizontal offset would look a bit bad overall. These are minor details, but if anyone has any ideas how to solve these issues, please share!
ItemSize -> {{7, 7, Automatic}, {3, 3, Automatic}}
toGrid[]
$\endgroup${"Checkbox 2", Row[{Control[{{b, 0, ""}, {1, 0}}], If[a == 1, "", Unevaluated[Sequence[]]]}, Alignment -> Left]}
in the second row ofGrid
? $\endgroup$