5
$\begingroup$

I'm trying to create a "template" notebook for myself.
I want to get input from a single InputField, and then run a few operations on it.

How can I make the InputFiled (that is, the box itself) be prettier?

How can I manipulate it's style?

EDIT:
I was asked to define prettier (which stands to reason).
So let's have WolframAlpha's (website) input box as a refrence point.

$\endgroup$
2
  • 3
    $\begingroup$ Define "prettier". With[{img = ExampleData[{"TestImage", "Elaine"}]}, Panel@Column[{img, InputField[]}] ] :) $\endgroup$
    – rm -rf
    Oct 8, 2013 at 14:15
  • $\begingroup$ Ahhh... Lenna... $\endgroup$
    – Trevor
    Oct 8, 2013 at 14:32

1 Answer 1

11
$\begingroup$

You can get custom colors and rounded corners by adding a custom frame to a frameless InputField. The following code approximates the look of Wolfram Alpha's input field:

With[{opts = {FrameMargins -> 0, ImageMargins -> 0}},
    Framed[
        Framed[InputField[, ImageSize -> {500, 25}, Appearance -> "Frameless"], 
            FrameStyle -> Red, RoundingRadius -> 5, opts
        ],
        BoxFrame -> 3, RoundingRadius -> 7, FrameStyle -> Lighter@Orange, opts
    ]
]

Note that due to a bug, the FrameStyle option for Framed does not follow thickness directives (and possibly others), so a lower level workaround using BoxFrame is necessary.

$\endgroup$
1
  • $\begingroup$ Wow! Excellent solution! This would really make my "template" notebook so much prettier. Thanks. $\endgroup$
    – Trevor
    Oct 8, 2013 at 15:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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