The F1 help tells us that:
and:
Note that GRAPHIC DETACH is a V5 thing!
Just suppose that, you want to have REDRAW on during certain operations and OFF during others. You might imagine that you can just DETACH the GW and re-ATTACH it without the REDRAW option. And this would make sense!
But as the following code demonstrates, it doesn't work that way!
The question remains - how to make it work? My guess is that the current GW will have to be copied into a new "clean" GW, created without the REDRAW parameter.
I think it would be simpler though if the REDRAW status was not persistent, and as this seems to turn on the new V5 GRAPHIC DETACH functionality, no-one would be upset if it were to change - any views on this?
GRAPHIC ATTACH
...REDRAW
This option can provide a dramatic improvment in the execution speed of graphic statements, as it eliminates repetitive udates to the display. If this option is included, all drawing statements are buffered until a GRAPHIC REDRAW statement is executed, or the operating system chooses to update the target window. Without REDRAW, all graphical statements (Line, Box, Print, etc.) are performed immediately. However, in most cases, it's better to defer the display until a number of statements have been performed.
...REDRAW
This option can provide a dramatic improvment in the execution speed of graphic statements, as it eliminates repetitive udates to the display. If this option is included, all drawing statements are buffered until a GRAPHIC REDRAW statement is executed, or the operating system chooses to update the target window. Without REDRAW, all graphical statements (Line, Box, Print, etc.) are performed immediately. However, in most cases, it's better to defer the display until a number of statements have been performed.
GRAPHIC REDRAW
...This statement is only needed when GRAPHIC ATTACH with the REDRAW option have been chosen for faster, buffered draw operations. Otherwise, it performs no operation.
...This statement is only needed when GRAPHIC ATTACH with the REDRAW option have been chosen for faster, buffered draw operations. Otherwise, it performs no operation.
GRAPHIC DETACH
...Though detached from the graphic command stream, the graphic target (Window or Bitmap ) is not deleted, nor is it altered in any way. Until another graphic target is attached, any statements executed are ignored. If no graphic is attached, this statement performs no operation.
...Though detached from the graphic command stream, the graphic target (Window or Bitmap ) is not deleted, nor is it altered in any way. Until another graphic target is attached, any statements executed are ignored. If no graphic is attached, this statement performs no operation.
Just suppose that, you want to have REDRAW on during certain operations and OFF during others. You might imagine that you can just DETACH the GW and re-ATTACH it without the REDRAW option. And this would make sense!
But as the following code demonstrates, it doesn't work that way!
Code:
' to show that the GRAPHIC ATTACH REDRAW parameter is persistent #compile exe #dim all function pbmain () as long local hgw as dword local skey as string local i as long graphic window "redraw test (ESC to end)", 100, 100, 280, 200 to hgw graphic attach hgw, 0, redraw for i = 1 to 5 graphic print "UMBALA " sleep 500 next graphic redraw sleep 2000 graphic print "detach & re-attach w/o REDRAW" graphic redraw graphic detach graphic attach hgw, 0, redraw for i = 1 to 5 graphic print "UMBALA UMBALA " sleep 500 next graphic redraw graphic waitkey$ to skey graphic window end end function
I think it would be simpler though if the REDRAW status was not persistent, and as this seems to turn on the new V5 GRAPHIC DETACH functionality, no-one would be upset if it were to change - any views on this?
Comment