Re: Silly Mathematica button question
- To: mathgroup at smc.vnet.net
- Subject: [mg36196] Re: [mg36139] Silly Mathematica button question
- From: "Jonathan Rockmann" <MTheory at msn.com>
- Date: Mon, 26 Aug 2002 04:16:23 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Hi, You've gotten some very helpful responses so I'm just going to add a couple of comments. The following is an example of yet another type of button that you can use as a model. Copy and paste the following code into a notebook. When you evaluate it, it will create a button within the same notebook which when pressed evaluates the entire notebook. Sort of like selecting from the menu bar Kernel/Evaluation/Evaluate Notebook. This assumes of course that there is something in the notebook already to evaluate. So input 1+2 (and don't hit enter) somewhere in the notebook so that you can see what the effect of the button is. DisplayForm[Button[Evaluate*Notebook,ButtonFunction:>FrontEndExecute [FrontEndToken["EvaluateNotebook"]],ButtonEvaluator->None,Active->True]] It has the nice feature that it doesn't get stuck in a loop creating the button over and over again. However, with some enthusiasm you can make this happen too. Personally, I am fascinated by the Java integration in version 4.2. But I wouldn't recommend it to anyone who is just starting to program in Mathematica. Further, there is hardly enough material contained in the Help Browser to make sense of much of it. It is always a good idea to have several basic constructs of efficient, useful programs that can serve as models when programming. If you look at some of the MathGroup archived threads you will find similar complaints that the Mathematica documentation is confusing. Jonathan Rockmann mtheory at msn.com ----- Original Message ----- From: Lawson English To: mathgroup at smc.vnet.net Subject: [mg36196] [mg36139] Silly Mathematica button question Normally I don't feel so stupid, but I'm trying to create an interactive Mathematica notebook, and I'm stuck at square one. Specifically, how do I do something like create a button to add a number (or perform other mathematical functions) and then display or otherwise manipulate the result (eventually I want to be able to click a button that increments/decrements an angle and animate the resulting transformation of a vector, with an eye to finally simulating a simple robotic arm complete with simple controls to manipulate the arm). I want to have a variable (or matrix or whatever) defined as a global variable x, and then perform x = x+1 when a button is clicked. I've bee n using and programming computers for almost 25 years and I can't follow Wolfram's documentation. Is it just me, or is he always this obtuse when explaining things? I mean, given the amazing power of the Mathematica system, a sample list of buttons in a notebook that you could select and examine how they were implemented, would have been nice. I can't find such a list, and this seems to be par for the course for the rest of the documentation as well.