home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Boston 2
/
boston-2.iso
/
DOS
/
PROGRAM
/
BASIC
/
CDITQ
/
CODEIT.E_
/
DEMOW1.BAS
< prev
next >
Wrap
BASIC Source File
|
1992-05-27
|
11KB
|
317 lines
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'DEMOW1.BAS Copyright (C) 1991-1992, Clear Software. ALL RIGHTS RESERVED.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'$INCLUDE: 'CITOOLS.BI'
'$INCLUDE: 'CIWIND1.BI'
'$INCLUDE: 'CIMOUSE.BI'
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
DEFINT A-Z
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
CONST TRUE = -1, FALSE = 0
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Inititalize the mouse and paint the background.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
MouseInit
CLS
COLOR 15, 7
ScreenPaint 2, 79, 2, 22, ""
DrawBox 1, 80, 1, 23, 2
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Define the window.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
WindowDefine 1, 20, 60, 6, 16, "Button/Edit Field", 0, 2
WindowColors 7, 1, 7, 1, 15, 1, 1, 3
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Show the window.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
WindowOn 1
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Put the buttons and edit fields on the window.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
ButtonDefine 1, 1, 1, 2, 3, " Who ", 3
ButtonDefine 1, 2, 0, 2, 10, " What ", 3
ButtonDefine 1, 3, 0, 2, 18, " When ", 3
ButtonDefine 1, 4, 0, 2, 26, " Exit ", 3
ButtonDefine 1, 5, 1, 4, 6, "Button 4", 2
ButtonDefine 1, 6, 0, 4, 23, "Button 5", 2
ButtonDefine 1, 7, 1, 7, 3, " Where ", 5
ButtonDefine 1, 8, 0, 8, 3, " Why ", 5
ButtonDefine 1, 9, 0, 9, 3, " How ", 5
EditFieldColors 7, 0
EditFieldDefine 1, 10, "", 7, 19, 12, 20, "Fld 1:", 1
EditFieldDefine 1, 11, "", 9, 19, 12, 11, "Fld 2:", 2
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Define the CTRL A through CTRL D as a keypress to look for. When these keys
'are pressed the program shows the keypress at the top left of the screen.
'(See 31 - 34 in the window loop below)
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
WindowCtrlKey 1, "a"
WindowCtrlKey 2, "b"
WindowCtrlKey 3, "c"
WindowCtrlKey 4, "d"
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Draw the lines and the box in the window.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
WindowDrawLine 1, 3, "─"
WindowDrawLine 1, 5, "─"
WindowDrawBox 1, 2, 16, 6, 10, 2
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Place the cursor on the first item when the window is made active. Also
'set cursor for the group buttons when one of the groups is selected.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
item = 1
curGp1 = 1
curGp2 = 5
curGp3 = 7
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Show the mouse and enter the window loop. The first select case determines
'which item is current and prints the correct description line for it.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
WDONE = FALSE
MouseShow
WHILE NOT WDONE
MouseHide
COLOR 0, 7
LOCATE 23, 2: PRINT SPACE$(78)
SELECT CASE item
CASE 1, 2, 3, 4
LOCATE 23, 2
PRINT " <ARROW=Next Item> <TAB=Next Button Set> <ENTER=Accept> <ESCAPE=Exit>"; ""
CASE 5
LOCATE 23, 2
PRINT " <SPACE BAR=Toggle Button> <TAB=Next Button> <ESCAPE=Exit>"; ""
CASE 6
LOCATE 23, 2
PRINT " <SPACE BAR=Toggle Button> <TAB=Next Button Set> <ESCAPE=Exit>"; ""
CASE 7, 8, 9
LOCATE 23, 2
PRINT " <ARROW=Next Item> <TAB=Go To Edit Field 1> <ESCAPE=Exit>"; ""
CASE 10
LOCATE 23, 2
PRINT " <TAB=Go To Edit Field 2> <ESCAPE=Exit>"
CASE 11
LOCATE 23, 2
PRINT " <TAB=Next Button Set> <ESCAPE=Exit>"
END SELECT
MouseShow
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'Make the window active. When a key or mouse button is pressed find out which
'one.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
WindowActive item
SELECT CASE WindowEvent(0) 'Find out what took place.
CASE 1 'A mouse event took place so
SELECT CASE WindowEvent(1) 'find out on which button or
CASE 4 'edit field.
WDONE = TRUE
CASE 1, 2, 3
item = WindowEvent(1)
curGp1 = item
CASE 7, 8, 9
ButtonToggle curGp3
item = WindowEvent(1)
curGp3 = item
ButtonToggle curGp3
CASE 10, 11
item = WindowEvent(1)
CASE 5, 6
ButtonToggle curGp2
curGp2 = WindowEvent(1)
ButtonToggle curGp2
item = curGp2
END SELECT
CASE 2 'A key was pressed so find out
SELECT CASE WindowEvent(2) 'which key and what button or
CASE 1 'edit field th cursor was on.
SELECT CASE item
CASE 4
WDONE = TRUE
END SELECT
CASE 2
WDONE = TRUE
CASE 3
SELECT CASE item
CASE 1, 2, 3
item = 5
CASE 4
ButtonToggle item
item = 5
ButtonToggle 1
curGp1 = 1
CASE 5
item = item + 1
CASE 6
item = curGp3
CASE 7, 8, 9
curGp3 = item
item = 10
CASE 10
item = item + 1
CASE 11
item = curGp1
END SELECT
CASE 5
SELECT CASE item
CASE 7, 8, 9
ButtonToggle item
item = item - 1
IF item < 7 THEN
item = 9
END IF
ButtonToggle item
curGp3 = item
END SELECT
CASE 6
SELECT CASE item
CASE 7, 8, 9
ButtonToggle item
item = item + 1
IF item > 9 THEN
item = 7
END IF
ButtonToggle item
curGp3 = item
END SELECT
CASE 7
SELECT CASE item
CASE 5, 6
ButtonToggle item
END SELECT
CASE 8
SELECT CASE item
CASE 1, 2, 3, 4
ButtonToggle item
item = item - 1
IF item < 1 THEN
item = 4
END IF
ButtonToggle item
curGp1 = item
END SELECT
CASE 9
SELECT CASE item
CASE 1, 2, 3, 4
ButtonToggle item
item = item + 1
IF item > 4 THEN
item = 1
END IF
ButtonToggle item
curGp1 = item
END SELECT
'----Page up and Page down key actions
' │
'
CASE 23 'Page up
item = 1
curGp1 = item
CASE 24 'Page down
item = 11
'----CTRL key actions ─┐
'
CASE 31
COLOR 15, 2
LOCATE 1, 1: PRINT "CTRL A"
CASE 32
COLOR 15, 3
LOCATE 1, 1: PRINT "CTRL B"
CASE 33
COLOR 15, 4
LOCATE 1, 1: PRINT "CTRL C"
CASE 34
COLOR 15, 5
LOCATE 1, 1: PRINT "CTRL D"
END SELECT
END SELECT
WEND
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'The user chose to exit so hide the mouse and clean up the screen.
'::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
MouseHide
COLOR 7, 0
CLS
END