In a nutshell, I am working on a widget that consists of a wheel with
buttons. Currently I've just manually calculated out where 8 buttons go, and it works well, but I am trying to set it up with a user definable number of
buttons contained in array "mData."

Need help checking my math (and LCB syntax.) I took out some of the syntax
like setting paints and some other fluff, this is just calculating the
positions of each circle.

    -- tBigRad is the radius of the main circle across the widget
    if my width > my height then
      put my height/2 into tBigRad
    else
      put my width/2 into tBigRad
    end if

    -- tLilRad is the radius of each small button around the edge
    put tBigRad/4 into tLilRad

    -- finding the coordinates of the center of the main circle
    put my width/2 into tBigX
    put my height/2 into tBigY
    put point [(my width/2),(my height/2)] into tCenter
fill circle path centered at tCenter with radius tBigRad on this canvas

-- create an "inner circle" by subtracting the radius of a button from
the radius of the main circle
    put tBigRad - tLilRad into tInnerRad
    -- calculate angle in radians from the for the center of each button
    put (the number of elements in mData)/(2 * pi()) into tButtonAngles

repeat with tButtonNumber from 1 up to the number of elements in mData
      put tInnerRad * (tButtonNumber-1 * tButtonAngles) into tAngle
      put tBigX * cos(tAngle * pi()) into tButtonX
      put tBigY * sin(tAngle * pi()) into tButtonY
      put point [tButtonX, tButtonY] into tButtonCenter
fill circle path centered at tButtonCenter with radius tLilRad on this
canvas
    end repeat

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to