Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread J. Landman Gay
On 12/10/12 4:38 PM, Robert Sneidar wrote: Value forces LC to evaluate the expression. Also, you can do something like, "value("the name of me", card 1)". Only other thing I can think of is that "do" compiles a statement at runtime. That means if you have a LOT of do statements running in a loop,

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 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 > > Otherwise you trig

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Robert Sneidar
uot;sin" in tTrigFunction >>>> replace "cosine" with "cos" in tTrigFunction >>>> replace "tangent" with "tan" in tTrigFunction >> >> Use: >> >>>> replace "cosine" with "cos" in t

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Jim Hurley
t;sine" with "sin" in tTrigFunction >>> replace "tangent" with "tan" in tTrigFunction > > If you replace "sine" with "sin" you also change "cosine" to "cosin" (There > is a "sine" in "cosi

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Roger Guay
"sine" with "sin" in tTrigFunction >>> replace "tangent" with "tan" in tTrigFunction > > If you replace "sine" with "sin" you also change "cosine" to "cosin" (There > is a "sine" in &quo

Re: Capture the Trig Function from an Option Menu Button

2012-12-10 Thread Jim Hurley
nction If you replace "sine" with "sin" you also change "cosine" to "cosin" (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

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-livec

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 wrote: > > On Dec 10, 2012, at 8:59 AM, Jim Hurley wrote: > >> get "put the " & tTrigFunction & " of " & tAngle & " into y " >> do it >> > > Hi, Jim and Roger. > >

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 wrote: > > On Dec 10, 2012, at 8:59 AM, Jim Hurley wrote: > >> get "put the " & tTrigFunction & " of " & tAngle & " into y " >> do it

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 " & tTrigFunction & " of " & tAngle & " into 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
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 wrote: > It turns o

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 Jim Hurley
Sorry, Roger, I guess I forgot about that part. Try the script below: >> On Dec 9, 2012, at 8:47 PM, Jim Hurley > > 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 >> statemen

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 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 execute as a > Switch

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 write

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 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 t

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 exists

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 wrote: > Roger- > > Saturday, December 8, 2012, 7:52:59 PM, you wrote: > >> Please forgive my ignorance here, Mark, but are you suggesting >> another way of do

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 var

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 wrote: > Jim- > > Saturday, December 8, 2012, 10:11:31 AM, you wrote: > >> But could you tell me how this "mouseUP" handle fails to

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 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 that locks like this

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 preven

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 Roger Guay
Thank you, Mark. Works great! On Dec 7, 2012, at 5:40 PM, Mark Wieder 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-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, u

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread Roger Guay
, BNig < > >> niggemann@ > >> > wrote: >> >>> on otherHandler theta >>> get "put the" && (sOption) && "of" && theta >>> do it >>> put cr & it&& the result after mess

Re: Capture the Trig Function from an Option Menu Button

2012-12-07 Thread BNig
t; > niggemann@ > > wrote: > >> on otherHandler theta >> get "put the" && (sOption) && "of" && theta >> do it >> put cr & it&& the result after message >> end otherHandler -- View this mes

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 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
line Kind regards Bernd -- View this message in context: http://runtime-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.

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 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 wrote: > >> Maybe parens like >> get "(p

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 wrote: > Maybe parens like > get "(put the" && sOption && "of" && theta & ")" > would help? > (untested) ___ use-livecode maili

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 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 >

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 it&&the result end otherHandler When I execute t

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

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,

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 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 in

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",