BoxDrawText with Erase Flag Not Working
Keywords: BoxDrawText
Question:
I use BoxDrawText() to draw different text at the same location. I set "erase flag" to @TRUE ( the background should be cleared.), but the background text is always there. It's not be cleared. Why?Thanks.
Answer:
Only the bounding rectangle in the BoxDrawText statement is erased. If you select a font too large, it can print outside the box. And that part is not erased.Question (cont'd):
I still don't understand.Hear's my scripts, you can run it and take a look to see what's wrong. Thanks.
BoxesUp("200, 400, 800, 800",@NORMAL) BoxCaption(1,"WinBatch Utility is Running!") BoxColor(1,"0,0,255",0) BoxDrawRect(1,"0,0,1000,1000",1) BoxTextColor(1,"0,255,0") BoxTextFont(1,"Times Roman", 150, 70, 0) BoxDrawText(1, "250,150,750,500", "UDF.TXT file Generator", @False, 1) BoxTextFont(1,"Times Roman", 100, 70, 0) BoxDrawText(1, "250,350,750,600", "Please wait ... ...", @False, 1) For i=1 to 20 time = TimeDate() BoxDrawText(1, "250,550,750,700", "Current Time: %time%", @TRUE, 1) TimeDelay(1) Next TimeDelay(20)Answer:
The problem is that the clear flag will cause the rectangle defined in the function to be cleared.But the text you display can extend beyond the rectangle. So it does not look like it is getting cleared. Try making the rectangle larger.
The size of your box was a bit too small for the text you are displaying. Rather than cut off your text - WinBatch is friendly enough to run the text outside the box - BUT then only clears the background in the coordinates you specified. Try this:
BoxesUp("200, 400, 800, 800",@NORMAL) BoxCaption(1,"WinBatch Utility is Running!") BoxColor(1,"0,0,255",0) BoxDrawRect(1,"0,0,1000,1000",1) BoxTextColor(1,"0,255,0") BoxTextFont(1,"Times Roman", 150, 70, 0) BoxDrawText(1, "250,150,750,250", "UDF.TXT file Generator", @False, 1) BoxTextFont(1,"Times Roman", 100, 70, 0) BoxDrawText(1, "250,350,750,450", "Please wait ... ...", @False, 1) For i=1 to 20 time = TimeDate() timeline=StrCat("Current Time: ",time) BoxDrawText(1, "50,550,950,700", timeline, @TRUE, 1) TimeDelay(1) Next TimeDelay(20)
Article ID: W12755Filename: BoxDrawText Not Working.txt