Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Jim Hurley
It turns out that Do is fast enough. Here is the Do script: (The script might read a litle better by using x in the repeat loop instead of i.) on mouseUp put the label of btn myOptionMenu into tTrigFunction --It might be necessary to take care in using the following replacements

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Roger Guay
This script is amazingly fast! And so are you, having apparently produced it in less than an hour!! My script appears to be slightly slower using a switch/case structure. I'll test it out when I get a moment. Thanks very much, Roger On Dec 10, 2012, at 8:59 AM, Jim Hurley

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Dick Kriesel
On Dec 10, 2012, at 8:59 AM, Jim Hurley wrote: get put the tTrigFunctionof tAngleinto y do it Hi, Jim and Roger. If you like more concise code, you can code the above like this: put value( tTrigFunction ( tAngle ) ) into y -- Dick

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Roger Guay
Ah yes, I had a vague recollection of this but couldn't quite get it right. I love it! Thanks, Roger On Dec 10, 2012, at 10:31 AM, Dick Kriesel dick.krie...@mail.com wrote: On Dec 10, 2012, at 8:59 AM, Jim Hurley wrote: get put the tTrigFunctionof tAngleinto y

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Roger Guay
Question: Is this essentially a Do statement in a clever disguise? On Dec 10, 2012, at 10:31 AM, Dick Kriesel dick.krie...@mail.com wrote: On Dec 10, 2012, at 8:59 AM, Jim Hurley wrote: get put the tTrigFunctionof tAngleinto y do it Hi, Jim and Roger. If

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Dick Kriesel
On Dec 10, 2012, at 10:40 AM, Roger Guay wrote: Question: Is this essentially a Do statement in a clever disguise? Yes, although the value function can do more than it does in this example (see the dictionary for details). -- Dick ___ use-livecode

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Jim Hurley
From: Roger Guay i...@mac.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Capture the Trig Function from an Option Menu Button Message-ID: 2f8eaa01-f970-48e0-af7a-7733af7e4...@mac.com Content-Type: text/plain; CHARSET=US-ASCII This script is amazingly fast! And so are you

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Roger Guay
reverse the order of these first two. Jim -- Message: 3 Date: Mon, 10 Dec 2012 09:42:55 -0800 From: Roger Guay i...@mac.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Capture the Trig Function from an Option Menu Button Message-ID

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Jim Hurley
(There is a sine in cosine) So reverse the order of these first two. Jim -- Message: 3 Date: Mon, 10 Dec 2012 09:42:55 -0800 From: Roger Guay i...@mac.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Capture the Trig Function from

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Robert Sneidar
Guay i...@mac.com To: How to use LiveCode use-livecode@lists.runrev.com Subject: Re: Capture the Trig Function from an Option Menu Button Message-ID: 2f8eaa01-f970-48e0-af7a-7733af7e4...@mac.com Content-Type: text/plain; CHARSET=US-ASCII This script is amazingly fast! And so are you, having

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Roger Guay
Oh yes, I know. Thanks very much! On Dec 10, 2012, at 2:11 PM, Jim Hurley jhurley0...@sbcglobal.net wrote: And Roger, in my code the positive y axis is the usual screen y axis--positive down. If you want to use the traditional cartesian y-axis--positive up-- change y0 + y to y0 - y

Re: Capture the Trig Function from an Option Menu Button

2012-12-09 Thread Roger Guay
Aw shucks, Mark . . . twas notten. I just copy the many geniuses on this list! Cheers, Roger On Dec 8, 2012, at 8:59 PM, Mark Wieder mwie...@ahsoftware.net wrote: Roger- Saturday, December 8, 2012, 7:52:59 PM, you wrote: Please forgive my ignorance here, Mark, but are you suggesting

Re: Capture the Trig Function from an Option Menu Button

2012-12-09 Thread Jim Hurley
Well, Mark, maybe not so flexible. For example, to use Do with the arctan() function in LC, as you suggest, would require you to replace the arctan text with atan text, or more likely the atan2 text, as that is how LC expresses that trig funciton. That might not be easy if arctan text

Re: Capture the Trig Function from an Option Menu Button

2012-12-09 Thread Mark Wieder
Jim- Sunday, December 9, 2012, 12:36:07 PM, you wrote: In many cases it will boil down to taste, and I will grant you that that is no small issue. It is a good part of what makes coding satisfying. Good points all. I usually try to avoid do whenever I can due to its inherent slowness and the

Re: Capture the Trig Function from an Option Menu Button

2012-12-09 Thread Richard Gaskin
Jim Hurley wrote: But there is certainly a nice generic quality to Do. Never mind what, just Do it. And in that lies one more reason to use do only with great care: In areas where it may be affected by user inputs it can become an injection vulnerability. The rest of the language is

Re: Capture the Trig Function from an Option Menu Button

2012-12-09 Thread Jim Hurley
Hi Mark I can recall one case where Do was the perfect solution for me. It was a tutorial to help students understand the physics of the rainbow. It provided them with a mini-programing language, that allowed them to control how a ray of light might interact with a drop of water. They would

Re: Capture the Trig Function from an Option Menu Button

2012-12-09 Thread Roger Guay
On Dec 9, 2012, at 8:47 PM, Jim Hurley jhurley0...@sbcglobal.net wrote: In Roger Guay's problem it is a two step process, (1) get the value for the trig function and then (2) a statement, and them combine them into a printed statement. This process might be easier to read, and simpler to

Re: Capture the Trig Function from an Option Menu Button

2012-12-08 Thread Roger Guay
Thank you, Mark. Works great! On Dec 7, 2012, at 5:40 PM, Mark Wieder mwie...@ahsoftware.net wrote: Roger- Or try a one-liner: on otherHandler theta do put sOption ( theta ) end otherHandler -- -Mark Wieder mwie...@ahsoftware.net

Re: Capture the Trig Function from an Option Menu Button

2012-12-08 Thread Roger Guay
Hi Jim, I was trying to directly use the label of an option menu button (with sin, cos and tan as menu items) and combining that with the angle derived in another script. Something like: put (the label of btn myOptionMenu)(tangle) This result in

Re: Capture the Trig Function from an Option Menu Button

2012-12-08 Thread Mark Wieder
Jim- Saturday, December 8, 2012, 10:11:31 AM, you wrote: But could you tell me how this mouseUP handle fails to do the job? Well, it's not nearly as hard to read, for one thing. But seriously, the use of lambda functions (google it) can provide a degree of flexibility in code and help prevent

Re: Capture the Trig Function from an Option Menu Button

2012-12-08 Thread Roger Guay
On Dec 8, 2012, at 11:25 AM, Jim Hurley jhurley0...@sbcglobal.net wrote: I put my script into a separate button. I think yours was in the Option button. I did exactly as you did, i.e. put your script into a separate button, created 2 fields, 1 and 2 snip snip You should get a field 2

Re: Capture the Trig Function from an Option Menu Button

2012-12-08 Thread Roger Guay
Please forgive my ignorance here, Mark, but are you suggesting another way of doing this kind of thing? Thanks, Roger On Dec 8, 2012, at 11:15 AM, Mark Wieder mwie...@ahsoftware.net wrote: Jim- Saturday, December 8, 2012, 10:11:31 AM, you wrote: But could you tell me how this mouseUP

Re: Capture the Trig Function from an Option Menu Button

2012-12-08 Thread Mark Wieder
Roger- Saturday, December 8, 2012, 7:52:59 PM, you wrote: Please forgive my ignorance here, Mark, but are you suggesting another way of doing this kind of thing? Ah, sorry, no. Just describing what you were doing: using a variable to hold the name of a math operator an then executing the

Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
I know this is probably a stupid question, but I can't seem to make it work: I have an Option Menu button with sin, cos, tan as menu Items. I want my card script to take the label of that button, and then perform the trig function with that label. I've tried every thing I can think of to get,

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Paul Hibbert
Roger, Is this what you are looking for? If your script is triggered by a change of the option menu, then this format should work… on menuPick pItemName switch pItemName case sin put the sin of fld 1 into fld 2 break case cos put the cos of fld 1 into

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
Thanks for your help, Paul. Your second script is more like what I need. BUT, I need to capture the bare function to be used with angles that are derived from some other script. Something like: local theTrigFctn on thisHandler put the label of btn myOptiionMenu into tOption switch tOption

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread J. Landman Gay
Try: local sOption on thisHandler put the label of btn myOptiionMenu into sOption end test on otherHandler theta do put the sOption of theta end otherHandler On 12/7/12 4:02 PM, Roger Guay wrote: Thanks for your help, Paul. Your second script is more like what I need. BUT, I need to

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread J. Landman Gay
On 12/7/12 4:32 PM, J. Landman Gay wrote: Try: local sOption on thisHandler put the label of btn myOptiionMenu into sOption end test on otherHandler theta do put the sOption of theta end otherHandler Or shorter, to avoid the script local variable, read the option button directly:

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
Very close but still no cigar. I did the following to monitor what was happening on thisHandler put the label of btn myOptionMenu into sOption end thisHandler on otherHandler theta get put the sOption of theta do it put itthe result end otherHandler When I execute this for theta

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Jerry Jensen
On Dec 7, 2012, at 3:02 PM, Roger Guay i...@mac.com wrote: Very close but still no cigar. I did the following to monitor what was happening on thisHandler put the label of btn myOptionMenu into sOption end thisHandler on otherHandler theta get put the sOption of theta do it

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
Good thought, but it doesn't work either. And Idid try moving the parens around. On Dec 7, 2012, at 3:21 PM, Jerry Jensen j...@jhj.com wrote: Maybe parens like get (put the sOption of theta ) would help? (untested) ___ use-livecode mailing

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Jerry Jensen
I tried it too. Didn't work. Once again, I learn to test before posting. On Dec 7, 2012, at 3:31 PM, Roger Guay i...@mac.com wrote: Good thought, but it doesn't work either. And Idid try moving the parens around. On Dec 7, 2012, at 3:21 PM, Jerry Jensen j...@jhj.com wrote: Maybe

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread BNig
-revolution.278305.n4.nabble.com/Capture-the-Trig-Function-from-an-Option-Menu-Button-tp4657927p4657937.html Sent from the Revolution - User mailing list archive at Nabble.com. ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
Thank you, Bernd. Seems to work. Now to understand. Cheers, Roger On Dec 7, 2012, at 4:05 PM, BNig niggem...@uni-wh.de wrote: on otherHandler theta get put the (sOption) of theta do it put cr it the result after message end otherHandler

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread BNig
the (sOption) of theta do it put cr it the result after message end otherHandler -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Capture-the-Trig-Function-from-an-Option-Menu-Button-tp4657927p4657939.html Sent from the Revolution - User mailing list

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
after message end otherHandler -- View this message in context: http://runtime-revolution.278305.n4.nabble.com/Capture-the-Trig-Function-from-an-Option-Menu-Button-tp4657927p4657939.html Sent from the Revolution - User mailing list archive at Nabble.com

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Mark Wieder
Roger- Or try a one-liner: on otherHandler theta   do put sOption ( theta ) end otherHandler -- -Mark Wieder mwie...@ahsoftware.net ___ use-livecode mailing list use-livecode@lists.runrev.com Please visit this url to subscribe, unsubscribe