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

Eric Chatonet eric.chatonet at sosmartsoftware.com
Wed Jun 29 15:02:27 EDT 2005


Hi Wouter,

When I need a grid I use a field the borderColor of which I set.
For instance with a field named "Grid" which is 141 pixels high and  
281 pixels broad (I picked this handler in a project):

on creategrid pGridValue
   local tLoc
   -----
   lock screen
   put the loc of fld "Grid" into tLoc
   set the textHeight of fld "Grid" to pGridValue
   set the tabstops of fld "Grid" to pGridValue-1,2 * pGridValue - 1
   set the height of fld "Grid" to (140 div pGridValue) * pGridValue + 1
   set the width of fld "Grid" to (280 div pGridValue) * pGridValue + 1
   set the loc of fld "Grid" to tLoc
   unlock screen
end creategrid

Another approach which don't misunderstand the bug but can help?

Le 29 juin 05 à 20:45, Wouter a écrit :

> 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
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>




More information about the use-livecode mailing list