Consider the following snippet as a reference.
DynamicModule[{},
Manipulate[
Graphics[
Translate[
GeometricTransformation[
{ Blue,
Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}]
}, {{scx, 0}, {0, scy}}
],
Tuples[{Range[wi], Range[he]}] - 1
],
ImageSize -> 400 {1, 1}
],
{{scx, 1, "x scale"}, 0, 1},
{{scy, 1, "y scale"}, 0, 1},
{{wi, 1, "width"}, 1, 5, 1},
{{he, 1, "heigth"}, 1, 5, 1}
]
]
A graphical drawing program with a lot of controls (buttons, sliders) would benefit (a lot) by freeing up space and moving controls to a Palette
, or a similar construct. I am considering the redesign of a GUI and I am currently investigating the options and technical possibilities. - Looking at the reference code snippet (which is not the GUI in question, but makes asking the question - and answering! - so much easier) I have the following question. Is it possible to move (one of) the sliders to a Palette
, or similar construct?
Answer
You can use the "wormhole" construct from "tutorial/AdvancedDynamicFunctionality" like this:
Manipulate[
Graphics[
Translate[
GeometricTransformation[{Blue,
Polygon[{{0, 0}, {1, 0}, {1, 1}, {0, 1}}]}, {{scx, 0}, {0,
scy}}], Tuples[{Range[wi], Range[he]}] - 1],
ImageSize -> 400 {1, 1}],
OpenerView[{Button["external",
CreateDialog[DynamicModule[{}, Column[{
Control[{{scx, 1, "x scale"}, 0, 1}],
Control[{{scy, 1, "y scale"}, 0, 1}],
Control[{{wi, 1, "width"}, 1, 5, 1}],
Control[{{he, 1, "heigth"}, 1, 5, 1}]
}], InheritScope -> True]
]],
Column[{
Control[{{scx, 1, "x scale"}, 0, 1}],
Control[{{scy, 1, "y scale"}, 0, 1}],
Control[{{wi, 1, "width"}, 1, 5, 1}],
Control[{{he, 1, "heigth"}, 1, 5, 1}]
}]}]
]
Comments
Post a Comment