Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: BoxDataClear Stack Management
BoxesUp("0,0,1000,1000",@NORMAL) BoxNew(2,"0,0,1000,1000",2) BoxColor(2,GREY,0)When I manually minimize the graphics window and then restore it, everything that's been written to the window is gone. Likewise, if I cover the window with another window, everything covered is erased. And in some cases, a ghost image of the second window stays on the graphics window and only disappears if I minimize the graphics window and then restore it.
Obviously the graphics routines are not properly repainting the contents of the window. Is there a solution?
The three lines of script you provided did not do much and immediately exited so there was no time to see what was going on. I modified the supplied script a bit so as to be able to actually see what was going on.
The script will keep the window around till you hit the ESCAPE key...
BLUE="0,0,255" RED="255,0,0" BoxesUp("0,0,1000,1000",@NORMAL) BoxNew(2,"0,0,1000,1000",2) BoxColor(2,BLUE,0) BoxDrawRect(2,"0,0,1000,1000",2) BoxColor(2,RED,0) BoxDrawCircle(2,"300,200,700,800",2) WaitForKey("{ESC}","","","","")Using this script I do not see any paint problems when minimizing and restoring or covering with another window.
I still suspect you are clearing the drawing stack too soon. When a repaint occurs it will only repaint up to the end of the defined drawing stack, and it a portion of it was cleared...well then the cleared items are not repainted.
Is there some way of increasing the size of the command stack beyond this rather modest limit to avoid getting the "stack full" error? Any known work-around if someone wants to draw a lot of stuff to the screen, and have it stay there?
The trick is to draw all the fixed elements first, then Insert a BoxDataTag, then draw the rapidly varying elements. Also, for BoxDrawText, make sure you set the subsequent erase flags to @TRUE.
Right before you redraw the rapidly varying elements, then do a BoxDataClear for the named tag. I guess the idea is to do the BoxDataClear before the drawing of the last portion, rather than after. As in:
;; sample script for BoxDataClear BoxesUp("100,100,900,900", @normal) BoxColor(1,"255,255,0",0) BoxDrawRect( 1, "0,0,1000,1000", 2) BoxDataTag(1, "tag1") ;INSERT THE TAG HERE BEFORE VARYING ELEMENTS BoxDrawText(1, "0,200,1000,1000", "WinBatch Box Example - BoxDataClear ", @false, 1) BoxCaption(1, "WinBatch BoxDataClear Example") ;BoxColor(1,"0,0,255", 0) ;THIS BOX IS CAUSING A PROBLEM WHEN NOT COMMENTED OUT BoxPen(1,"255,0,0",25) BoxDrawRect(1,"350,350,650,650", 1) BoxDrawLine(1, "350,700,800,700") TimeDelay(2) BoxDataClear(1, "tag1") ;SET THIS BEFORE THE NEXT VARYING TEXT: BOXDRAWTEXT BoxDrawText(1, "0,200,1000,1000", "BoxDataClear - Clearing Tags to redraw contents", @true, 1) ;SET TO @TRUE TimeDelay(3) BoxColor(1,"255,0,0", 0) BoxPen(1,"0,0,255",50) BoxDrawRect(1,"350,350,650,650", 1) BoxDrawLine(1, "350,700,800,700") TimeDelay(4)
When it is deleted, it cannot be redrawn if required - say by covering it temporarily with another window or iconizing it then showing it.
Only the items above the BoxDataTag are preserved to be re-drawn.
With your technique of frequent dataclears you are able to draw many many items, but these items are not preserved if a redraw is required.
My best suggestion is a "Screen Refresh" button which, when pressed, redraws the entire window.
Here's a snippet of code to test with:
BoxOpen("BarTest","Checking for stack error 10108 on Box function") BoxTextFont(1, "Terminal", 80, 0, 1) BarLen = 50 ;BarChr1 = Num2Char(176) ;BarChr2 = Num2Char(178) BarChr1 = "-" BarChr2 = "*" nThings=200 For i = 1 to nThings BarDone = (BarLen * i) / nThings PctBar = StrCat("[",StrFill(BarChr2,BarDone),StrFill(BarChr1,BarLen-BarDone),"]") StatusMsg = StrCat("Progress: ",PctBar,@CrLf,"Item '",i,"'") BoxText(StatusMsg) Next i
I added some code to make this script work. See the added BoxDataTag and BoxDataClear functions added.
BoxOpen("BarTest","Checking for stack error 10108 on Box function") BoxTextFont(1, "Terminal", 80, 0, 1) BarLen = 50 ;BarChr1 = Num2Char(176) ;BarChr2 = Num2Char(178) BarChr1 = "-" BarChr2 = "*" nThings=200 BoxDataTag(1,"tiptop") For i = 1 to nThings BoxDataClear(1,"tiptop") BarDone = (BarLen * i) / nThings PctBar = StrCat("[",StrFill(BarChr2,BarDone),StrFill(BarChr1,BarLen-BarDone),"]") StatusMsg = StrCat("Progress: ",PctBar,@CrLf,"Item '",i,"'") BoxText(StatusMsg) Next i
Article ID: W12754
Filename: BoxDataClear and Stack Management.txt
File Created: 2001:01:25:15:15:58
Last Updated: 2001:01:25:15:15:58