Re: mathematica question
- To: mathgroup at smc.vnet.net
- Subject: [mg40384] Re: [mg40338] mathematica question
- From: Omega Consulting <info at omegaconsultinggroup.com>
- Date: Thu, 3 Apr 2003 01:44:22 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
At 03:35 AM 4/2/2003, TUCKER C.Y wrote: >Hello >I've not used a newsgroup before so I'm not sure how to get in to post >questions, > but I need help with a problem in mathematica. > (If questions regarding mathematica are sent, > please could you post this question so I might get a >reply?) > >Problem: >In mathematica I want to create two or more buttons within >a cell. >When I press the first button I want some text (eg "correct") to appear , >(if possibly in same cell next to the buttons,if not in new >cell immediately below) >when i press another button i want the text to be written over > with another piece of text (eg "wrong") >How do I set the buttons up? > >Thanking you >Cheryl Tucker > >--------------------------------------- >TUCKER C.Y >tk313442 at stmail.staffs.ac.uk It just so happens that we recently released a package that does just this. You can get a full-featured demo at http://omegaconsultinggroup.com/Products/form/demo.html Once you've installed the package, you can do the following: <<FormMaker` NotebookPut[ MakeNotebook[ {SubmitBox["A", SetTarget["target", "Correct"]&], SubmitBox["B", SetTarget["target", "Wrong"]&], TargetBox["target", ""]} ]] A TargetBox is a target you can change. It has an identifier (or tag) "target" and it initially contains an empty string. A SubmitBox is a button that performs an action. So the first button has the text "A" on its face, and when it's pressed it executes a command. In this case, the command is SetTarget which reset the TargetBox with tag "target" to contain the text "Correct". There are further examples in the documentation. The package also includes a palette for creating forms interactively. -------------------------------------------------------------- Omega Consulting "The final answer to your Mathematica needs" http://omegaconsultinggroup.com