DAY 039: VIEW PRINT - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: Official Links (https://qb64phoenix.com/forum/forumdisplay.php?fid=16) +--- Forum: Learning Resources and Archives (https://qb64phoenix.com/forum/forumdisplay.php?fid=13) +---- Forum: Keyword of the Day! (https://qb64phoenix.com/forum/forumdisplay.php?fid=49) +---- Thread: DAY 039: VIEW PRINT (/showthread.php?tid=1308) |
DAY 039: VIEW PRINT - Pete - 12-19-2022 Every SCREEN ZERO HERO needs this keyword... SYNTAX VIEW PRINT [topRow% TO bottomRow%] Usage: Restricts the printable area of the screen. Okay, let's take this puppy for a spin. Use VIEW PRINT anytime you want to divide your text screen into a skin and message area. Code: (Select All) msg$ = "My Header" What's cool about VIEW PRINT is it leaves the last row unrestricted. That means we can print to the last row anytime we want, without changing the VIEW PRINT parameters. What else do we need to know here, Pete? Well, glad you asked! 1) CLEAR does not affect VIEW PRINT. 2) RUN removes VIEW PRINT. 3) CLS clears the whole screen. 4) CLS 2 only clears the VIEW PRINT area. 5) To get rid of the view print restriction, just code: VIEW PRINT 6) Remember when printing to the bottom of the screen to end your print statement with a semi-colon, so it doesn't scroll. 7) If you switch screens and switch back, you will have to redo your VIEW PRINT statement. 8) The top parameter must always be smaller than the bottom parameter. (If you're too dumb to figure that one out, switch to FreeBASIC). Pete RE: DAY 039: VIEW PRINT - mnrvovrfc - 12-19-2022 (12-19-2022, 04:48 AM)Pete Wrote: 6) Remember when printing to the bottom of the screen to end your print statement with a semi-colon, so it doesn't scroll.Sometimes printing a character at the most bottom-right corner with "PRINT" scrolls regardless of presence of semicolon. This happened to me while I created this GIF file: https://qb64phoenix.com/forum/attachment.php?aid=1234 I was forced to create another buffer which excluded the totally-black text line at the bottom. Actually off-topic because I didn't use "VIEW PRINT" for the program that created those images for the GIF file, but the thing about using "PRINT" on the bottom-most line is historical (not hysterical?) and even a semicolon might not prevent scrolling. RE: DAY 039: VIEW PRINT - bplus - 12-19-2022 Code: (Select All) Screen _NewImage(80 * 8, 16 * 25, 32) RE: DAY 039: VIEW PRINT - SMcNeill - 12-19-2022 (12-19-2022, 10:34 AM)mnrvovrfc Wrote:(12-19-2022, 04:48 AM)Pete Wrote: 6) Remember when printing to the bottom of the screen to end your print statement with a semi-colon, so it doesn't scroll.Sometimes printing a character at the most bottom-right corner with "PRINT" scrolls regardless of presence of semicolon. This happened to me while I created this GIF file: You need to use LOCATE and then PRINT with a semicolon, to print on the bottom 2 lines of the screen without scrolling happening. RE: DAY 039: VIEW PRINT - Dav - 12-19-2022 Oh cool - I didn't know about the CLS 2 option to just clear the VIEW PRINT area. Works great too. I always had a problem messing up the last line of a screen trying to clear a VIEW PRINT area, like in the example code below. Now with CLS 2 there is no problem. Always something to learn. Thanks for another keyword of the day! - Dav Code: (Select All) View Print 1 To 1 |