Capture the Trig Function from an Option Menu Button

Roger Guay irog at mac.com
Fri Dec 7 18:02:30 EST 2012


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 this for theta = pi/4, I get "put the Sin of 0.785398" with the result being empty. I I then copy "put the Sin of 0.785398" and paste back into the message box, it works with .707, the correct answer.

So close…….


On Dec 7, 2012, at 2:32 PM, "J. Landman Gay" <jacque at hyperactivesw.com> 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
> 
> 
> 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 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
>>      case "sin"
>>         put sin into theTrigFctn  --- you can't do this
>>         break
>>      case "cos"
>>         put cos into theTrigFctn  --- you can't do this
>>         break
>>      case "tan"
>>         put tan into theTrigFctn  --- you can't do this
>>         break
>>   end switch
>> end thisHandler
>> 
>> on otherHandler theta
>>     put theTrigFctn(theta)
>> end otherHandler
>> 
>> Thanks again,
>> Roger
>> 
>> 
>> 
>> 
>> On Dec 7, 2012, at 12:55 PM, Paul Hibbert <lc at pbh.on-rev.com> wrote:
>> 
>>> command thisHandler
>>>  put the label of btn "myOptiionMenu" into tOption
>>>  switch tOption
>>>      case "sin"
>>>         put the sin of fld 1 into fld 2
>>>         break
>>>      case "cos"
>>>         put the cos of fld 1 into fld 2
>>>         break
>>>      case "tan"
>>>         put the tan of fld 1 into fld 2
>>>         break
>>>   end switch
>>> end thisHandler
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>> 
> 
> 
> -- 
> Jacqueline Landman Gay         |     jacque at hyperactivesw.com
> HyperActive Software           |     http://www.hyperactivesw.com
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list