Announcement

Collapse
No announcement yet.

Graphics & Close in CC/4.04

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Graphics & Close in CC/4.04

    ' Checking out the graphics capabilitiess of cc4.04 and I'm having a
    ' couple of problems. The following code is what I have now.
    '
    ' 1. I want the graphics window to have a solid back background.
    ' When I REM out the #CONSOLE OFF statement, things go as
    ' expected. When I unREM the statement, the graphics window
    ' stays grey about 50 percent of the time and black the other
    ' 50 percent
    '
    ' 2. When I REM out the #CONSOLE OFF statement, I click the 'X'
    ' on the console window, the program ends and I keep on
    ' debugging. With #CONSOLE OFF active, I have to click the
    ' 'X' on the graphics window. The program seems to end but
    ' I have to bring up windows task manager, find it there and
    ' "End Task" before I continue debugging.
    '
    ' I remember reading that problem #2 has been discussed before
    ' but I can't find it.
    '
    ' Fixes anybody?
    '
    '
    Code:
    #COMPILE EXE
    #CONSOLE OFF
    '                                col   row   text
        DECLARE FUNCTION PrintString(LONG, LONG, STRING) AS STRING
        DECLARE SUB ShowMouse
    
    FUNCTION PBMAIN () AS LONG
        LOCAL hGw AS LONG
        MOUSE ON
        MOUSE 3, DOUBLE, DOWN
    
        fnt$ = "ocr-a bt"
    
        hGw = FREEFILE  '<---------------Just checking
    
        GRAPHIC WINDOW "Graphic Test Program", 50, 500,     750, 500 TO hGw
    '                                          Over  Down | Wide Deep
    '                                          Opening    | In pixels
    '                                          position   |
    '                                          on console |
        GRAPHIC ATTACH hGw, 0
    
    '   Make the entire window a black background
        GRAPHIC BOX (0,0) - (750,500),0, %BLACK , %BLACK ,0
    
    
        GRAPHIC COLOR RGB( 255, 153,    0), %BLACK
        GRAPHIC FONT fnt$, 20,0
    
        printstring( 0, 30,fnt$)
        PrintString( 0,  0, "ABCDEFG")
    
        GRAPHIC REDRAW
    
        DO
        WHILE INSTAT = 0
        showmouse
    
        WEND
        an$ = INKEY$
        IF an$ = CHR$(27) THEN EXIT LOOP
        LOOP
    
    END FUNCTION
    
    SUB ShowMouse
        PrintString(700,425,STR$(MOUSEX))
        PrintString(700,450,STR$(MOUSEY))
    
    
        END SUB
    
    FUNCTION PrintString(col AS LONG, row AS LONG, txt AS STRING ) AS STRING
    
        GRAPHIC SET POS ( col, row )
    '   Same as LOCATE ROW,COL except this is COL, ROW
        GRAPHIC PRINT txt$
        END FUNCTION
    '
    There are no atheists in a fox hole or the morning of a math test.
    If my flag offends you, I'll help you pack.

  • #2
    From the help file:

    #CONSOLE [ON|OFF]

    If you disable the console window, do not use commands that expect keyboard input, such as WAITKEY$, WAITSTAT, INPUT, or INKEY$. With no console from which to acquire input, these commands will simply lock up.
    I ran it a dozen times and the background is always black. CC 4.0. Edit: Forgot to mention this was with #CONSOLE OFF remmed out.
    Last edited by Scott Hauser; 25 Jan 2008, 05:09 AM.
    The most exasperating part of the "rat race" is how often the rats are in the lead!

    Comment

    Working...
    X