Group Abstract Group Abstract

Message Boards Message Boards

0
|
7.3K 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 10 years ago
POSTED BY: Dirk Elseviers
6 Replies
POSTED BY: David Reiss
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

Is this the sort of behavior you are looking for:

Manipulate[{x, a, b}, {x, 0, 1}, 
 Item[Control[{a, {0, 1}}], Alignment -> Center], {b, 0, 1}]

Not entirely a beginner question! ;-)

POSTED BY: David Reiss

After edit (I added that control b has a caption).

Here is what I mean:

If you run this example:

Manipulate[Graphics[Circle[{a, b}, c]], {a, 1, 10}, "Caption of b", {b, 1, 10}, {c, 1, 10}, ControlPlacement -> {Left, Top, Top, Right}]

a & c will be indeed left & right, and "caption of b" & b on top, but to the left, instead of over the center of the circle..

David, I can't get your suggestion to work.

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