Message Boards Message Boards

Change width of input control in FormLayoutFunction?

Posted 8 years ago

I know that this should be very easy, but I can't seem to find the answer searching the docs or the discussions. Sorry.

How do I limit the width of input boxes in codes such as below? I only want each box to be about 4 characters wide.

FormPage[{"x1" -> "Number", "x2" -> "Number", "x3" -> "Number",  "y1" -> "Number", "y2" -> "Number", "y3" -> "Number"}, fn, 
 FormLayoutFunction -> Function[Grid[
    {{"dependent", #["x1", "Control"], #["x2", "Control"], #["x3",  "Control"]},
     {"independent", #["y1", "Control"], #["y2", "Control"], #["y3",   "Control"]}}]]]

Currently it looks like this:

enter image description here

Thanks in advance,

Mark Greenberg

POSTED BY: Mark Greenberg
4 Replies

...delete...

(one day there will be a way to delete one's post from the forum... ;-) )

POSTED BY: David Reiss
Posted 8 years ago

Yes. Wow! I never would have come up with that on my own. I'm glad I asked. Thank you, David. It works perfectly.

POSTED BY: Mark Greenberg

Well, I had to do some digging through the Documentation Center to accrete insight. And I ultimately found it in the Documentation for FormFunction under scope/controls in this example:

CloudDeploy[
 FormFunction[{"x" -> <|"Interpreter" -> "String", 
     "Control" -> 
      Function[
       Tooltip[InputField[##], 
        EntityValue[Entity["Species", "Species:FelisCatus"], 
         EntityProperty["Species", "Image"]]]]|>}, func]]

Since there's an explicit InputField there I just had to use this example as a hint for the answer I gave you.

POSTED BY: David Reiss

Something like this perhaps:

FormPage[{"x1" -> <|"Interpreter" -> "Number", 
    "Control" -> Function[InputField[##, ImageSize -> 25]]|>, 
  "x2" -> <|"Interpreter" -> "Number", 
    "Control" -> Function[InputField[##, ImageSize -> 25]]|>, 
  "x3" -> <|"Interpreter" -> "Number", 
    "Control" -> Function[InputField[##, ImageSize -> 25]]|>, 
  "y1" -> <|"Interpreter" -> "Number", 
    "Control" -> Function[InputField[##, ImageSize -> 25]]|>, 
  "y2" -> <|"Interpreter" -> "Number", 
    "Control" -> Function[InputField[##, ImageSize -> 25]]|>, 
  "y3" -> <|"Interpreter" -> "Number", 
    "Control" -> Function[InputField[##, ImageSize -> 25]]|>}, fn, 
 FormLayoutFunction -> 
  Function[Grid[{{"dependent", #["x1", "Control"], #["x2", 
       "Control"], #["x3", "Control"]}, {"independent", #["y1", 
       "Control"], #["y2", "Control"], #["y3", "Control"]}}]]]
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

Group Abstract Group Abstract