Nice cm ruler. Only a click away

Mark Talluto userev at canelasoftware.com
Wed Nov 2 19:50:24 EDT 2011


Hi Michael,

I added to your very cool script a slight bit to make the cm ruler true on any monitor.  Users will have to adjust the three variables at the top to represent their monitors accurately.

on mouseUp
      put 1920 into tMonitorWidth
      put 1200 into tMonitorHeight
      put 24 into tMonitorDiag
      
      put sqrt((tMonitorWidth * tMonitorWidth) + (tMonitorHeight * tMonitorHeight)) into tDiagRes
      put round(tDiagRes/tMonitorDiag,3) into tDPI
      put tDPI /2.54 into Q
      
      repeat with i = 0 to 10
            new grc
            set the style of last grc to Polygon
            set the points of last grc to 25,300 & return & 25,307
            set the loc of last grc to 25+ i*Q,300
            set the selected of last grc to true
            
            new grc
            set the style of last grc to Polygon
            set the points of last grc to 39,306 & return & 39,310
            set the loc of last grc to 39+ i*Q,302
            set the selected of last grc to true
            
            new fld
            set the opaque of last fld to false
            set the width of last fld to 17
            set the height of last fld to 15
            set the textSize of last fld to 9
            set the showBorder of last fld to false
            set the margins of last fld to 0,4,0,4
            set the textAlign of last fld to center
            set the lockText of last fld to true
            set the autoHilite of last fld to false
            set the showFocusBorder of last fld to false
            set loc of last fld to 25+ i*Q,292
            put i into last fld
            set the selected of last fld to true
      end repeat
      
      group
      
      set the showBorder of last grp to true
      set the lineSize of last grp to 1
      set the threeD of last grp to false
      set the height of last grp to 27
      set the opaque of last grp to true
      set the backgroundColor of last grp to 255,255,205
      set the borderColor of last grp to 147,147,147
      
      set the script of last grp to "on mouseDown" & cr & "grab me" & cr & "end mouseDown"
end mouseUp


On Nov 2, 2011, at 6:34 AM, Michael Kristensen wrote:

> Hi there
> 
> Here is a nice cm ruler that span fx a iMac 27. Only a click away.
> 
> Make a new wd
> Make a btn
> 
> Put this script in it and click...





More information about the Use-livecode mailing list