RE: Q: Can I create a button function ?
- To: mathgroup at smc.vnet.net
- Subject: [mg18862] RE: [mg18833] Q: Can I create a button function ?
- From: "Ersek, Ted R" <ErsekTR at navair.navy.mil>
- Date: Sun, 25 Jul 1999 03:30:03 -0400
- Sender: owner-wri-mathgroup at wolfram.com
X. Jing Li wrote: ------------------------- I am trying to create a Mathematica notebook as a calculator type application for our project. I put some buttons such as fraction, square root, integration, differentiation etc. inside the notebook and an editable cell which works as the work and result window. I also put in a "Clear" button which I want to clear the contents in the editable window when I click it. But I can not find a function which can clear the cell but keep the original notebook open. ------------------------- Did you check the following sources: http://www.mathsource.com/Content/General/Tutorials/Programming/0209-809 http://support.wolfram.com/FrontEnds/Buttons/index.html ------------------ Your ButtonFunction should use something like the following. nb=SelectrdNotebook[]; SelectionMove[nb,All,Cell]; NotebookDelete[nb] or nb=SelectrdNotebook[]; SelectionMove[nb,Next,Cell]; NotebookDelete[nb] ------------------ Tip: When your figuring out how to write the code for your ButtonFunction it's very helpful to have two notebooks displayed. In one notebook you evaluate (nb=SelectedNotebook[]), and you have several cells you can manipulate. In the second notebook you evaluate expressions like I give above. That way you can evaluate things one step at a time and see what is going on. If your ButtonFunction isn't too complicated you can have the ButtonFunction right in your ButtonBox expression. If you provide the code for an example giving you trouble I can get more specific. Regards, Ted Ersek ersektr at naviar.navy.mil