[REBOL] Re: win-offset? screen-offset? bug
From: brett:codeconscious at: 23-Mar-2002 17:09
Hi again,
> dependent on VID styles. I believe the problem is with panels/layout.
I think I've found why the win-offset? and screen-offset? functions
have problems with PANEL now. It was the interaction between the INIT
of PANEL and the processing of the LAYOUT function.
The problem I think is that within LAYOUT the variable is set before
the INIT of the face is processed. It should be after. This is because
during the processing of INIT the face is swapped when the
PARENT-FACE field is not none - this the case with the PANEL
style. Therefore the variable is invalidated.
I've included a patch below that modifies the LAYOUT function.
It would be better if LAYOUT was amended so I'll let feedback
back know too.
Watch line wrap...
; PATCH LAYOUT FUNCTION TO HANDLE PANELS
if 1202930 = checksum mold :layout [
use [
layout-function code-to-move block-to-change
removal-point
insertion-point
] [
; Code to search for
code-to-move: [
if :var [set :var new new/var: to-word :var var: none]
]
; The actual function definition (in context)
layout-function: second :layout
; Find the block to change and the the point of change
block-to-change: second third find layout-function 'while
removal-point: find block-to-change code-to-move
insertion-point: find block-to-change 'break
; Copy the code to just before the BREAK - ie after INIT has been
processed.
insert insertion-point copy/part removal-point length? code-to-move
; Remove the code from it's original position
remove/part removal-point length? code-to-move
]
Print "Layout patch for PANEL applied."
]
Regards,
Brett