Text Cursor

 BBS: Inland Empire Archive
Date: 06-09-92 (16:12)             Number: 193
From: CORIDON HENSHAW              Refer#: NONE
  To: RICH GELDREICH                Recvd: NO  
Subj: Text Cursor                    Conf: (2) Quik_Bas
DECLARE FUNCTION GetMode% ()
'============================================================================
'
'    MOUSE.BAS - Mouse Support Routines for the User Interface Toolbox in
'           Microsoft BASIC 7.1, Professional Development System
'              Copyright (C) 1987-1990, Microsoft Corporation
'
' NOTE:     This sample source code toolbox is intended to demonstrate some
'           of the extended capabilities of Microsoft BASIC 7.1 Professional
'           Development system that can help to leverage the professional
'           developer's time more effectively.  While you are free to use,
'           modify, or distribute the routines in this module in any way you
'           find useful, it should be noted that these are examples only and
'           should not be relied upon as a fully-tested "add-on" library.
'
'  PURPOSE: These routines are required for mouse support in the user
'           interface toolbox, but they may be used independently as well.
'
'  For information on creating a library and QuickLib from the routines
'  contained in this file, read the comment header of GENERAL.BAS.
'============================================================================

DEFINT A-Z

'$INCLUDE: 'menu.bi'

COMMON SHARED /uitools/ GloMenu      AS MenuMiscType
COMMON SHARED /uitools/ GloTitle()   AS MenuTitleType
COMMON SHARED /uitools/ GloItem()    AS MenuItemType

FUNCTION GetMode%
DIM Regs AS RegType
Regs.AX = &HF00
CALL INTERRUPT(&H10, Regs, Regs)
Mode% = (&HFF AND Regs.AX)
IF Mode% < 4 THEN GetMode = FALSE
IF Mode% >= 4 THEN GetMode = TRUE
END FUNCTION

SUB MouseBorder (row1, col1, row2, col2) STATIC

    ' =======================================================================
    ' Sets max and min bounds on mouse movement both vertically, and
    ' horizontally
    ' =======================================================================

    MouseDriver 7, 0, (col1 - 1) * 8, (col2 - 1) * 8
    MouseDriver 8, 0, (row1 - 1) * 8, (row2 - 1) * 8

END SUB

SUB MouseDriver (m0, m1, m2, m3) STATIC

    DIM Regs AS RegType

    IF MouseChecked = FALSE THEN
        DEF SEG = 0

        MouseSegment& = 256& * PEEK(207) + PEEK(206)
        MouseOffset& = 256& * PEEK(205) + PEEK(204)

        DEF SEG = MouseSegment&

        IF (MouseSegment& = 0 AND MouseOffset& = 0) OR
PEEK(MouseOffset&) = 207 THEN
            MousePresent = FALSE
            MouseChecked = TRUE
            DEF SEG
        END IF
    END IF

    IF MousePresent = FALSE AND MouseChecked = TRUE THEN
        EXIT SUB
    END IF

    ' =======================================================================
    ' Calls interrupt 51 to invoke mouse functions in the MS Mouse Driver.
    ' =======================================================================

    Regs.AX = m0
    Regs.Bx = m1
    Regs.CX = m2
    Regs.DX = m3

    INTERRUPT 51, Regs, Regs

    m0 = Regs.AX
    m1 = Regs.Bx
    m2 = Regs.CX
    m3 = Regs.DX

    IF MouseChecked THEN EXIT SUB

    ' =======================================================================
    ' Check for successful mouse initialization
    ' =======================================================================

    IF m0 AND NOT MouseChecked THEN

--- msgedsq 2.0.5
 * Origin: -=- Point Blank -=- Support Fidonet Reform -=-
Me, an EchoTwit? -=- (1:250/804.200)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET