SCROLLTEXT help please

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • John Moorby
    Member
    • Nov 2011
    • 27

    SCROLLTEXT help please

    I'm trying to use the SCROLLTEXT option in PB/CC6. The new line of specified text appears as expected at the bottom of the page and uses the desired foreground and background colours. However, the remainder of the line where no text is specified always appears with a white background even though I have not specified a white background anywhere in the coding. How do I make my desired background (it happens to be %BLACK) accepted as the default background for the whole new line?
  • Dale Yarker
    Member
    • Mar 2004
    • 5513

    #2
    Do you want whole console to have black background?

    Use CON.COLOR then CON.CLS before any other code.

    Make that GRAPHIC COLOR and GRAPHIC CLEAR.
    (You didn't say GRAPHIC WINDOW, but console does not SCROLLTEXT )

    Cheers,
    Dale

    Comment

    • John Moorby
      Member
      • Nov 2011
      • 27

      #3
      Thanks for your response. I'm using GRAPHICS mode because the bulk of the program requires it. I have tried inserting (eg) GRAPHIC COLOR %GRAY,%BLACK but that only affects new text, and if I use GRAPHICS CLEAR or GRAPHICS CLEAR %BLACK then that removes all the previous output that I want to show.

      Comment

      • Dale Yarker
        Member
        • Mar 2004
        • 5513

        #4
        . . . then that removes all the previous output that I want to show
        Even if you put before ALL other code?
        Dale

        Comment

        • Borje Hagsten
          Member
          • Jan 2000
          • 8548

          #5
          Try GRAPHIC REDRAW after text is printed.

          Comment

          • Rodney Hicks
            • Apr 2007
            • 5279

            #6
            Or show some compileable code that shows the issue.
            Rod
            In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

            Comment

            • John Moorby
              Member
              • Nov 2011
              • 27

              #7
              For what it's worth, I use a workaround to give the imminent 'new' row a black background. Just before the GRAPHIC PRINT statement that specifies the 'new' text and which prompts the page scroll, I insert a GRAPHIC BOX statement specifying a black box covering where the new row will be at the bottom of the page. This achieves the result I want, but it is not 'elegant'!

              Comment

              • Borje Hagsten
                Member
                • Jan 2000
                • 8548

                #8
                Quick test - see no color problem here.
                '
                Code:
                FUNCTION PBMAIN
                  LOCAL hWin AS DWORD
                
                  GRAPHIC WINDOW "Scroll Text", 200, 200, 400, 240 TO hWin
                
                  GRAPHIC ATTACH hWin, 0, REDRAW
                  GRAPHIC COLOR %YELLOW, %BLACK
                  GRAPHIC SET SCROLLTEXT
                  GRAPHIC CLEAR
                
                  FOR y& = 0 TO 100
                    GRAPHIC PRINT "Whatever" + STR$(y&)
                    GRAPHIC REDRAW
                  NEXT
                
                  SLEEP 2000
                END FUNCTION
                '

                Comment

                • John Moorby
                  Member
                  • Nov 2011
                  • 27

                  #9
                  Thanks for all your responses. I will try to make the problem clearer by showing some fragments of code, but that may take a while. Don't hold your breath!

                  Comment

                  • John Moorby
                    Member
                    • Nov 2011
                    • 27

                    #10
                    A quick response to Borje: I ran your suggested code and got the same problem that caused me to raise this issue. The page background colour is fine prior to scrolling. After scrolling, the 'new' rows are ok ONLY where the new text is present. Further along each scrolled row (to the right of the new text) the background has become 'white'.

                    Comment

                    • John Moorby
                      Member
                      • Nov 2011
                      • 27

                      #11
                      Sample code. The indents have disappeared!
                      Press Esc to quit. Try running with GRAPHIC BOX line rem'd out.

                      FUNCTION PBMAIN
                      DEFLNG i-n: DEFDBL a-h,o-z
                      REM
                      REM ------------------- specify graphics window ----------------------
                      DESKTOP GET CLIENT TO iwin,jwin: REM whole screen except sys tray
                      GRAPHIC WINDOW NEW " GRAPHICS SCREEN ", 0,0,iwin, jwin TO igraf
                      FONT NEW "Consolas",16,0,1,0,0 TO ifont16: REM size, normal, ANSI char set, pitch, angle
                      REM
                      REM ---------------------- default choices ---------------------------
                      GRAPHIC ATTACH igraf,0,REDRAW: REM update graphics only with REDRAW
                      GRAPHIC SCALE (0.,0.)-(1280.,720.): REM user chosen scale
                      GRAPHIC CLEAR %BLACK: REM desired graphics screen
                      GRAPHIC SET FONT ifont16: REM default font
                      GRAPHIC SET SCROLLTEXT 1: REM enable page scrolling
                      REM
                      REM
                      GRAPHIC COLOR %GRAY,%BLACK: GRAPHIC SET POS (36,48)
                      GRAPHIC PRINT "Colour blu grn red"
                      REM
                      REM ----------------- blend colours ----------------------------------
                      1100 fr=RND:fg=RND: fb=RND: REM 0<random<1
                      r=INT(fr*255): g=INT(fg*255): b=INT(fb*255)
                      red$=HEX$(r,2): grn$=HEX$(g,2): blu$=HEX$(b,2)
                      h$=red$+grn$+blu$: clr=VAL("&H"+h$)
                      GRAPHIC COLOR clr
                      REM
                      REM try running with next statement rem'd out
                      GRAPHIC BOX (1,696)-(1279,720),,%BLACK,-1
                      GRAPHIC PRINT USING$(" & ### ### ###",h$,r,g,b)
                      GRAPHIC REDRAW
                      GRAPHIC WAITKEY$ TO a$: REM press any key to get next colour
                      IF a$<>CHR$(27) THEN 1100: REM ... or press [ESC] to quit
                      REM
                      END FUNCTION

                      Comment

                      • Rodney Hicks
                        • Apr 2007
                        • 5279

                        #12
                        Running your code, I see issues when the GRAPHIC BOX line isn't commented out. With it commented out, it works as expected. But if I change the GRAPHIC CLEAR statement to anything but %BLACK I see the issue. Baffling, it gets even worse with GRAPHIC SET VIRTUAL.

                        On another front, I suggest DIALOG DOEVENTS immediately after 1100.
                        Rod
                        In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                        Comment

                        • Michael Mattias
                          Member
                          • Aug 1998
                          • 43488

                          #13
                          Pad the text you are SCROLLTEXT'ing with SPACE$(CON.SCREEN.COL) before SCROLLTEXT'ing.

                          MCM
                          Not really a console compiler guy but I am pretty sure this will work
                          Michael Mattias
                          Tal Systems (retired)
                          Port Washington WI USA
                          [email protected]
                          http://www.talsystems.com

                          Comment

                          • Borje Hagsten
                            Member
                            • Jan 2000
                            • 8548

                            #14
                            Hm, don't see any problem. No white background - all is black. Compiler PB/CC 6.03 and Windows 10. Only time I see white background after printing below edge is when I add -1 (for def. color) last to last GRAPHIC COLOR command. Maybe can try to add %BLACK there, so it looks like GRAPHIC COLOR clr, %BLACK.

                            Comment

                            • Rodney Hicks
                              • Apr 2007
                              • 5279

                              #15
                              Borje, try changing the GRAPHIC CLEAR statement to anything but %BLACK and see what you get. Without the GRAPHIC BOX.
                              Rod
                              In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                              Comment

                              • Dale Yarker
                                Member
                                • Mar 2004
                                • 5513

                                #16
                                Originally posted by Michael Mattias View Post
                                Pad the text you are SCROLLTEXT'ing with SPACE$(CON.SCREEN.COL) before SCROLLTEXT'ing.

                                MCM
                                Not really a console compiler guy but I am pretty sure this will work
                                No, it won't. He's not using a console, it's a GRAPHIC window . . failure to read . . . AGAIN!
                                Dale

                                Comment

                                • Borje Hagsten
                                  Member
                                  • Jan 2000
                                  • 8548

                                  #17
                                  Changing background color changes nothing, except colors. Exactly presented code without BOX line still looks ok in my Win10 system.
                                  If nothing else works, Michael's suggestion about padding with spaces should be a good old reliable "fix".

                                  Comment

                                  • Rodney Hicks
                                    • Apr 2007
                                    • 5279

                                    #18
                                    Strange, when I scroll past the bottom of the screen if I don't use the default colours or black, I see what John's talking about. PBWin 10 and PBCC 6 on Win 10.
                                    Even GRAPHIC CLEAR %BLACK has the issue if GRAPHIC COLOR clr alone is used, %BLACK or -2 as the second parameter make it work.
                                    Rod
                                    In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                                    Comment

                                    • John Moorby
                                      Member
                                      • Nov 2011
                                      • 27

                                      #19
                                      I didn't tell you that I am running Windows 10 Pro 64 bit on a Dell running with Intel i7-3770.
                                      I have tried some of the ideas suggested, but I cannot get away from the basic problem - ie the PRINTED text always has the right foregrd and backgrd, but after scrolling starts the right hand end of the new lines shows 'white' instead of the desired black (unless I use that BOX statement.

                                      Comment

                                      • Rodney Hicks
                                        • Apr 2007
                                        • 5279

                                        #20
                                        John, try this code, I don't know that it's much different than what you;re doing but it works here.

                                        Code:
                                        FUNCTION PBMAIN
                                          DEFLNG i-n: DEFDBL a-h,o-z
                                        REM
                                        REM ------------------- specify graphics window ----------------------
                                          DESKTOP GET CLIENT TO iwin,jwin: REM whole screen except sys tray
                                          GRAPHIC WINDOW NEW " GRAPHICS SCREEN ", 0,0, iwin-100, jwin-500TO igraf  ' adjusted to fit my screen.
                                          FONT NEW "Consolas",16,0,1,0,0 TO ifont16: REM size, normal, ANSI char set, pitch, angle
                                        REM
                                        REM ---------------------- default choices ---------------------------
                                          GRAPHIC ATTACH igraf,0,REDRAW: REM update graphics only with REDRAW
                                          'GRAPHIC SCALE (0.,0.)-(1280.,720.): REM user chosen scale 'because my monitor is in portrait mode
                                          GRAPHIC CLEAR %BLACK: REM desired graphics screen
                                          GRAPHIC SET FONT ifont16: REM default font
                                          GRAPHIC SET SCROLLTEXT 1: REM enable page scrolling
                                          'graphic set virtual iwin, jwin
                                        REM
                                        REM
                                          GRAPHIC COLOR %GRAY,%BLACK: GRAPHIC SET POS (36,48)
                                          GRAPHIC PRINT "Colour blu grn red"
                                        REM
                                        REM ----------------- blend colours ----------------------------------
                                          1100 fr=RND:fg=RND: fb=RND: REM 0<random<1
                                          r=INT(fr*255): g=INT(fg*255): b=INT(fb*255)
                                          red$=HEX$(r,2): grn$=HEX$(g,2): blu$=HEX$(b,2)
                                          h$=red$+grn$+blu$: clr=VAL("&H"+h$)
                                          GRAPHIC COLOR clr, %BLACK ' works with -2 instead of %BLACK
                                        REM
                                        REM try running with next statement rem'd out
                                          'GRAPHIC BOX (1,696)-(1279,720),,%BLACK,-1
                                          GRAPHIC PRINT USING$(" & ### ### ###",h$,r,g,b)
                                          GRAPHIC REDRAW
                                          GRAPHIC WAITKEY$ TO a$: REM press any key to get next colour
                                          IF a$<>CHR$(27) THEN 1100: REM ... or press [ESC] to quit
                                        REM
                                        GRAPHIC WINDOW END
                                        END FUNCTION
                                        Rod
                                        In some future era, dark matter and dark energy will only be found in Astronomy's Dark Ages.

                                        Comment

                                        Working...
                                        X