Sweet little progress ARC library

Chipp Walters chipp at chipp.com
Sun Dec 1 20:33:00 EST 2013


Needed to create some libs for showing progress for this dashboard
recently.
https://dl.dropboxusercontent.com/u/3788438/DONOTMOVE/Screenshot%202013-12-01%2019.13.26.png

The point of the Dashboard was to allow exec mgmt to review progress. I
built it and then purchased one of those Android on a sticks and plugged it
into a nice HDTV. I set it up so it runs continuously, panning from one
screen to the next.

Anyway, I needed some libraries to set the starting and ending points of
the arcs based on both percentage and degrees. Thought I'd share them
here...

Works sorta like this:

put the long ID of grc "Arc1" into tObjID
put "45" into tPercentCompleted --> 45% ARC
put "90" into tStartAngle --> START FROM THE TOP
put "clockwise" into tDirection --> ARC 'GROWS' CLOCKWISE
--> NOW CALL IT
altSetPercentComplete tObjID, tPercentCompleted, tStartAngle, tDirection

on altSetPercentComplete pObjID,pPercent,pStartAngle,pDirection
   if the style of pObjID is not "Oval" then exit altSetPercentComplete
   if pPercent is "" then put 0 into pPercent
   if pStartAngle is "" then put 90 into pStartAngle
   if pDirection is "" then put "clockwise" into pDirection
   put 3.6 * pPercent into tDegrees
   altSetArcAngle pObjID,tDegrees,pStartAngle,pDirection
end altSetPercentComplete

on altSetAngle pObjID,pAngle,pStartAngle,pDirection
   if the style of pObjID is not "Oval" then exit altSetAngle
   if pAngle is "" then put 0 into pAngle
   if pStartAngle is "" then put 90 into pStartAngle
   if pDirection is "" then put "clockwise" into pDirection
   altSetArcAngle pObjID,pAngle,pStartAngle,pDirection
end altSetAngle

on altSetArcAngle pObjID,pDegrees,pStartAngle,pDirection
   if the style of pObjID is not "Oval" then exit altSetArcAngle
   lock screen
   if pDegrees is "" then put 270 into pDegrees
   if pStartAngle is "" then put 90 into pStartAngle
   if pDirection is "" then put "clockwise" into pDirection
   if pDirection is "clockwise" then
      set the arcAngle of pObjID to pDegrees
      set the startAngle of pObjID to pStartAngle-pDegrees
   else
      set the arcAngle of pObjID to pDegrees
      set the startAngle of pObjID to pStartAngle
   end if
   unlock screen
end altSetArcAngle



More information about the use-livecode mailing list