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
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
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
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
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
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
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
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
(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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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,
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
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
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
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:
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
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
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
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
-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
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
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
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
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
37 matches
Mail list logo