Group Abstract Group Abstract

Message Boards Message Boards

0
|
8.2K Views
|
4 Replies
|
1 Total Like
View groups...
Share
Share this post:

How do I create a vertical RadioButtonBar in FormObject?

RadioButtonBar has an option Appearance->"Vertical". But I am using RadioButtonBar in a FormObject (basically to create multiple-choice questions), and in the documentation this is specified as "Control"->RadioButtonBar. But that gives the default horizontal bar. How do I specify a vertical set of radio buttons? I can't supply the Appearance option to RadioButtonBar without some button specification arguments first, but in the context of FormObject those are picked up from the other parts of the FormObject spec. Here is an example of a FormObject that gives horizontal buttons, and therefore looks ugly because of the long labels:

form3 = FormObject[<|
   "Response" -> <|
     "Interpreter" -> {"None at all." -> 1, 
       "Some stuff in high school." -> 2, 
       "I have taken one or two intro-level college classes." -> 3, 
       "I have written code for research in an Independent Study or similar." -> 4, "I have mad skillz and write my own apps." -> 5}, 
     "Control" -> RadioButtonBar|>|>]
POSTED BY: Gareth Russell
4 Replies
POSTED BY: Hans Michel
POSTED BY: Gareth Russell

Thanks so much! I had indeed tried it as a function, but it was the ## (SlotSequence) that I was missing: I only used a single #.

POSTED BY: Gareth Russell

Gareth Russell:

Please try the following:

FormObject[<|
  "Response" -> <|
    "Interpreter" -> {"None at all." -> 1, 
      "Some stuff in high school." -> 2, 
      "I have taken one or two intro-level college classes." -> 3, 
      "I have written code for research in an Independent Study or \
similar." -> 4, "I have mad skillz and write my own apps." -> 5}, 
    "Control" -> 
     Function[RadioButtonBar[##, Appearance ->  "Vertical"]]|>|>]

enter image description here

"Control" takes a pure Function.

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