weird influence of the gridsize and the grid on the drawing of squares by script

Wouter wouter.abraham at scarlet.be
Wed Jun 29 14:45:36 EDT 2005


Hi all,

After reinvestigating bug 2683 for which Mark Waddingham asked a  
recipe,  the weird influence of the gridsize and the grid on the  
drawing of squares by script surfaced. Will it become an  
"undocumented feature" or is this a bug?  Anyway I didn't know until  
now.
1 new stack and 1 button with the following script will show:

on mouseUp
   put gridsize into  tOldgridsize
   put the grid into tOldgrid
   set the grid to true  ### Mark Schonewille for this detail
   if there is no img "test" then create img "test"
   set the rect of img "test" to 0,0,400,400
   set gridsize to 1
   creategrid 50,50
   set gridsize to 2
   creategrid 160,50
   set gridsize to 3
   creategrid 50,160
   set gridsize to 4
   creategrid 160,160
   set gridsize to 6
   creategrid 50,270
   set gridsize to 10
   creategrid 160,270
   set gridsize to  tOldgridsize
   set the grid to tOldgrid
end mouseUp

on createGrid x,y  ### topleft of grid
   choose the rectangle tool
   set the filled to true
   set the brushcolor to 255,255,255
   set the pencolor to 0,0,0
   put 10 into tCol   ### number of columns
   put 10 into tRow   ### number of rows
   put 10 into tSq    ### tSq = size of square
   put 1 into tCY
   repeat tRow
     put (y + (tCY * tSq) - tSq) into tY
     put 1 into tCX
     repeat tCol
       put (x + (tCX * tSq) - tSq) into tX
       drag from tX,tY to tX + tSq ,tY + tSq
       add 1 to tCX
     end repeat
     add 1 to tCY
   end repeat
   choose browser tool
end createGrid

So when drawing by script, the gridsize and/or the grid should be  
taken care of.
May be the influence of those settings have a bigger scope (not  
tested yet).

Greetings,
Wouter



More information about the use-livecode mailing list