$INCLUDE "Rapidq.inc"
DECLARE SUB PaintBox_Click
DECLARE SUB ExitTheProg (Key as BYTE)
DIM TheCurrentColor     AS INTEGER
    TheCurrentColor = 1    
    
CREATE Form AS QForm
    Width = 660
    Height = 512    
    Top = 0
    'Left = Screen.Width
    Color = RGB(255,0,0)
    BorderStyle = bsToolWindow    'Dialog
    OnClick = PaintBox_Click
    OnKeyPress = ExitTheProg
    Caption = "RGB Max"
    Cursor = crCross        'crIBeam        'crNone
    ShowModal
END CREATE



SUB PaintBox_Click
    IF TheCurrentColor = 4 THEN
        TheCurrentColor = 1
    ELSE
        INC(TheCurrentColor)
    END IF
    SELECT CASE TheCurrentColor
        CASE 1
            Form.Color = RGB(255,0,0)
        CASE 2
            Form.Color = RGB(0,255,0)
        CASE 3
            Form.Color = RGB(0,0,255)
        CASE 4
            Form.Color = RGB(255,255,255)            
     END SELECT
END SUB


SUB ExitTheProg(Key as BYTE)
    IF Key = 27 THEN Application.Terminate    'Esc
    IF Key = 13 THEN PaintBox_Click        'button or return key
END SUB
    
