Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.7K Views
|
6 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How can I center a Top and/or Bottom Control in a Manipulate demo?

Posted 11 years ago

Another beginners question, I'm afraid. I'm working on a demo with lots of controls, and I manage to distribute them Left, Right, Top & Bottom with ControlPlacement. But the Top & Bottom controls stay left-aligned and I would like to center them under the drawing. Thanks for helping.

POSTED BY: Dirk Elseviers
6 Replies

Many thanks. I read about DynamicModule but it seemed daunting, but now I feel encouraged to get into it.

I found a primitive solution to my problem for the faint of heart: simply pad the b controls with spaces!

I would post the code, but the editor here takes the spaces right back out. Is there a way around that?

Also, how does one post a manipulate output like Nasser did? Or should I start a new question?

POSTED BY: Dirk Elseviers

The next step is to simply abandon Manipulate altogether and build your interactive with DynamicModule. Ultimately that is what I always end up doing if I start by creating a Manipulate. Typically though I almost always start with is, in fact, a DynamicModule: it gives you complete detailed control of your design.

POSTED BY: David Reiss

Looks great! Many thanks!!

POSTED BY: Dirk Elseviers

The secret trick to obtain complete control of locations of controls is to use Manipulate[None,....] and then simply use Grid to layout everything. The dynamic content itself, can now be placed anywhere, and the controls in any location in the main display area. I like to use this method since now the controls can be placed near the dynamics it is supposed to manipulate. I found this method sometime ago by accident when I was trying to figure how solve similar problem you are having. With this method, any possible layout can be made very easily. Forget about ControlPlacement, and use the powerful Grid :). ps. Also Item can be very handy here.

Manipulate[None,
 Grid[{{Grid[{{Control[{a, 1, 10}]},{"Caption of b"},{Control[{b, 1, 10}]}}],
    Grid[{{Control[{c, 1, 10}]},{Dynamic@Plot[Sin[a x] + b c, {x, -2 Pi, 2 Pi}, ImagePadding -> 10, 
         AxesOrigin -> {0, 0}, Frame -> True]}}]}}, TrackedSymbols :> {a, b, c}]

enter image description here

Here is a demo that uses the above method DynamicAnalysisOfASecondOrderSystemWithHarmonicLoading

POSTED BY: Nasser M. Abbasi
POSTED BY: Dirk Elseviers
POSTED BY: David Reiss
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard