Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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}
  ]
]

Mathematica graphics

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?

share|improve this question
1  
According to @Yoda, these problems can be solved with a hardware upgrade chat.stackexchange.com/transcript/message/4922520#4922520 –  belisarius Jun 11 '12 at 22:06

2 Answers 2

up vote 9 down vote accepted

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}]
     }]}]

 ]
share|improve this answer
1  
+1 was just about to write that. Well, at least I can go to bed 20 min earlier than I would have gone otherwise:) –  Ajasja Jun 11 '12 at 22:19

Something like this?

scx = scy = wi = he = 1;

CreateDocument@
  Dynamic@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}];

CreatePalette[
  Grid[
   {
    {"x scale", Slider[Dynamic[scx], {0, 1}]},
    {"y scale", Slider[Dynamic[scy], {0, 1}]},
    {"width", Slider[Dynamic[wi], {1, 5, 1}]},
    {"heigth", Slider[Dynamic[he], {1, 5, 1}]}
    }
   ]
  ];

Mathematica graphics

share|improve this answer
    
When I delete the palette the SaveDialog appears, is that expected behavior for a Palette? ( Albert Refey's answer has a show/unshow button. ) - How do you merit your solution against the CreateDialog answer? –  ndroock1 Jun 12 '12 at 7:07
1  
@ndroock1 From the documentation: CreatePalette[expr] creates an unsaved palette notebook containing expr and opens it in a separate window. To save the palette, close the window and save the file when the save dialog appears or save the palette notebook programmatically using NotebookSave. You asked for a Palette and you got one ;-). –  Sjoerd C. de Vries Jun 12 '12 at 7:39
    
@ Sjoerd, Yep, a palette I got. And it's good its documented here how to create one. I am not entirely sure which way to go yet though. –  ndroock1 Jun 12 '12 at 8:01
    
@ndroock1 Note that this wasn't a citation from the CreatePalette help page itself, but from the tutorial. So, upon first reading, the appearance of the Save dialog box isn't very obvious indeed. –  Sjoerd C. de Vries Jun 12 '12 at 10:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.