Manipulate[
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}}],
{{RTT, .1, "round trip time"}, .03, .25, Appearance -> "Labeled"}
]
But I want the slider that controls the RTT variable to have a
prettier appearance. I would like it to display the value to the right
of the control, but instead of a plain number I want it to show
ToString[Round[1000 RTT]] <> "ms"
How can I achieve this?
Thanks,
Damon.
I'm sure you can talk Manipulate into doing what you want, but it is one
of the cases where I think creating the interface from scratch using
Dynamic and DynamicModule is more straight forward:
Deploy[Panel[DynamicModule[{RTT = 0.1},
Column[{
Grid[{{
"round trip time",
Manipulator[Dynamic[RTT], {0.03, 0.25}],
InputField[
Dynamic[Round[1000 RTT]],
Appearance -> None, ImageSize -> 20, Enabled -> False
],
"ms"
}}],
Panel[
Dynamic[
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}}]
], Background -> White]
}]
]]]
if you want the value to work as a Controle, that is only slightly more
complicated:
Deploy[Panel[DynamicModule[{RTT = 0.1},
Column[{
Grid[{{
"round trip time",
Manipulator[Dynamic[RTT], {0.03, 0.25}],
InputField[
Dynamic[Round[1000 RTT], (RTT = #/1000) &],
Appearance -> None, ImageSize -> 20
],
"ms"
}}],
Panel[
Dynamic[
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}}]
], Background -> White]
}]
]]]
hth,
albert
Throw Manipulate into the ashcan and make your own dynamic display.
DynamicModule[
{RTT = .1},
Panel[
Column[
{Row[
{"Round Trip Time: ",
Slider[Dynamic[RTT], {0.03, 0.25}, Appearance -> Small],
Spacer[10],
Dynamic@
Style[PaddedForm[Round[1000 RTT], 3], FontFamily -> "Courier"],
Spacer[2], "ms"
}](* Row *),
Dynamic@
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}},
ImageSize -> 400]}](* Column *),
Style["Custom Dynamic Display", 16],
BaseStyle -> {FontSize -> 14}
](* Panel *)
]
You could also have used a Manipulator rather than a Slider. I didn't want
the value on the right to 'jitter' as the slider is moved so I used a
PaddedForm and the Courier font to keep the number fixed width.
With the Presentations package we could stay with the default "Segoe UI"
font used in Panels and keep the width fixed by using
ProportionalNumberForm.
Needs["Presentations`Master`"]
DynamicModule[
{RTT = .1},
Panel[
Column[
{Row[
{"Round Trip Time: ",
Slider[Dynamic[RTT], {0.03, 0.25}, Appearance -> Small],
Spacer[10],
Dynamic@ProportionalNumberForm[Round[1000 RTT], 4], Spacer[2],
"ms"
}](* Row *),
Dynamic@
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}},
ImageSize -> 400]}](* Column *),
Style["Custom Dynamic Display", 16],
BaseStyle -> {FontSize -> 14}
](* Panel *)
]
David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/
From: Damon [mailto:damonw...@gmail.com]
I have a simple Manipulate,
Manipulate[
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}}],
{{RTT, .1, "round trip time"}, .03, .25, Appearance -> "Labeled"}
]
But I want the slider that controls the RTT variable to have a
prettier appearance. I would like it to display the value to the right
of the control, but instead of a plain number I want it to show
ToString[Round[1000 RTT]] <> "ms"
How can I achieve this?
Thanks,
Damon.
in Version 7 there is the very useful Control[] wrapper. I find it
useful for interface layout, because you can use controls e.g. in a Grid:
Manipulate[
Plot[Sqrt[2]/(RTT*Sqrt[p]), {p, .001, .1},
PlotRange -> {{0, .1}, {0, 150}}],
Grid[{{Control[{{RTT, .1, "round trip time"}, .03, .25}],
Dynamic[NumberForm[RTT, {3, 4}]], "ms"}}]]
Regards,
Yves
Damon schrieb: