Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: object funnies

From: gchiu:compkarori at: 18-Oct-2001 19:28

On Thu, 18 Oct 2001 13:18:30 +1000 Anton Rolls <[arolls--idatam--com--au]> wrote:
> Perhaps there is a different value for cellsize > in another context. > Better show us the code.
Hi Anton/Andrew I guess this is the most likely answer, but I can't see it. The working program with the resizeable game board is at sites/compkarori/gorim2.r ( http://www.compkarori.co.nz/reb/gorim2.r ) which saves the file http://www.compkarori.co.nz/reb/gomoku4.r to the local drive as %gomoku3.r and executes it In gorim2.r, there is no code left that alters the value of 'cellsize. 'cellsize is defined initially as 20 in gomoku4.r It is only redefined in the function 'resize-board ( in gomoku4.r ) which is executed on receiving a resize event This is just the first part of the function as it is quite long resize-board: func [ size [pair!] /local x ] [ bk/size: size cellsize: to-integer ( size/y - 60 ) / 20 ; print [ "new cellsize: " cellsize ] init-variables ...... ] and this is the first part of 'do-preview do-preview: func [ act pos /local x y tmp tmp2 tmp3 topedge result ] [ cellsize: gridsize/x ;!! have to do this as somehow keeping the old value of cellsize print [ "Cellsize: " cellsize ] ..... ] It works correctly with the assignment I make in the first line of the function, but it bothers me that I have to do it. If you want to see it, just uncomment the two print statements, run gorim2.r, and then when you're logged on to the chat server, click on the "send" option on the menu. That brings up a board. As you move the mouse over the board, it will start printing. Resize, and it will print the new cellsize, but without the reassignment, the cellsize remains the same ... -- Graham Chiu