Fun with Function Keys

or

Programming the Function Keys to assist

Drawing Lines or Writing Foreign Languages

Back to GW-BASIC Table of Contents
Back to Frankenbook's Table of Contents

The following eleven programs simply change the Function keys
to draw box drawing characters or allow the insertion of some 
special pronounciation characters into French, German or 
Spanish language writing.

There is a lot more you can do with the function keys within 
a program by using them to call subroutines, merge programs 
or data but none of that was ever needed by a Joseph_Sixpack.
There are a lot of tricks that GW-BASIC can do that a 
Joseph_Sixpack doesn't need to do.

Anyhow here is the first of the programs that change the 
function keys to enable easier box drawing.

Single Line Box Drawing ala WordStar

10 'Configure Function Keys vertical is single horizonal is single 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(179) 40 KEY 2, CHR$(196) 50 KEY 3, CHR$(218) 60 KEY 4, CHR$(191) 70 KEY 5, CHR$(192) 80 KEY 6, CHR$(217) 90 KEY 7, CHR$(194) 100 KEY 8, CHR$(193) 110 KEY 9, CHR$(195) 120 KEY 10, CHR$(180) 130 ' cross intersect is chr$(197) 140 ' run"ascii.bas 'for other chr$(???) values 150 ' save"DRAWV1H1.BAS",a

Single Vertical, Double Horizontal

10 'Configure Function Keys verticals are single, horizonals are double 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(179) 40 KEY 2, CHR$(205) 50 KEY 3, CHR$(213) 60 KEY 4, CHR$(184) 70 KEY 5, CHR$(212) 80 KEY 6, CHR$(190) 90 KEY 7, CHR$(209) 100 KEY 8, CHR$(207) 110 KEY 9, CHR$(198) 120 KEY 10, CHR$(181) 130 ' cross intersect is chr$(216) 140 ' run"ascii.bas 'for other chr$(???) values 150 ' save"DRAWV1H2.BAS",a

Double Vertical, Single Horizontal

10 'Configure Function Keys verticals are double, horizonals are single 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(186) 40 KEY 2, CHR$(196) 50 KEY 3, CHR$(214) 60 KEY 4, CHR$(183) 70 KEY 5, CHR$(211) 80 KEY 6, CHR$(189) 90 KEY 7, CHR$(210) 100 KEY 8, CHR$(208) 110 KEY 9, CHR$(199) 120 KEY 10, CHR$(182) 130 ' cross intersect is chr$(215) 140 ' run"ascii.bas 'for other chr$(???) values 150 ' save"DRAWV2H1.BAS",a

Double Vertical, Double Horizontal

10 'Configure Function Keys verticals are double horizonals are double 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(186) 40 KEY 2, CHR$(205) 50 KEY 3, CHR$(201) 60 KEY 4, CHR$(187) 70 KEY 5, CHR$(200) 80 KEY 6, CHR$(188) 90 KEY 7, CHR$(203) 100 KEY 8, CHR$(202) 110 KEY 9, CHR$(204) 120 KEY 10, CHR$(185) 130 ' cross intersect is chr$(206) 140 ' run"ascii.bas 'for other chr$(???) values 150 ' save"DRAWV2H2.BAS",a

Function keys dressed up to use as program keys

The next three programs, draw boxes. 10 CLS:key on 20 LOCATE,,,0,7 'generates a block cursor 30 ' 40 'ProgramFunctionKeys: 50 'use the following six lines to draw the boxes around the Function keys 60 'in the mnu-main.bas and other menuing screens. 70 KEY 1,CHR$(218) 'F1 = upper left corner 80 KEY 2,CHR$(196) 'F2 = top and bottom longitudinal bar 90 KEY 3,CHR$(191) 'F3 = upper right corner 100 KEY 4,CHR$(179) 'F4 = vertical bar 110 KEY 5,CHR$(192) 'F5 = bottom left corner 120 KEY 6,CHR$(217) 'F6 = bottom right corner 130 'Now draw Function Key Outlines Using F1 to F6 Keys: 140 'Don't forget the semi-colon at the end of each line. 150 'and enclose the box drawing characters in quotes. 160 LOCATE 22,1 170 PRINT"┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐"; 180 PRINT"│ HELP ││ ││ ││ ││ ││ ││ ││ ││PRIOR ││ NEXT │"; 190 PRINT"└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘"; 200 'EmbeddedCommands: 210 ' SAVE"LINEDRAW.BAS",A

The same thing only a tad different

10 CLS:key on: LOCATE,,,0,7 'generates a block cursor 30 ' 40 'ProgramFunctionKeys: 50 'use the following six lines to draw the boxes around the Function keys 60 'in the mnu-main.bas and other menuing screens. 70 KEY 1,CHR$(218) 'F1 = upper left corner 80 KEY 2,CHR$(196) 'F2 = top and bottom longitudinal bar 90 KEY 3,CHR$(191) 'F3 = upper right corner 100 KEY 4,CHR$(179) 'F4 = vertical bar 110 KEY 5,CHR$(192) 'F5 = bottom left corner 120 KEY 6,CHR$(217) 'F6 = bottom right corner 130 ' 140 'Now draw Function Key Outlines Using F1 to F6 Keys: 150 'Don't forget the semi-colon at the end of each line. 160 LOCATE 22,1 170 PRINT"┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐┌──────┐"; 190 PRINT"│ HELP ││ ││ ││ ││ ││ ││ ││ ││PRIOR ││ NEXT │"; 200 PRINT"└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘└──────┘"; 210 ' 220 ' SAVE"LINDRAW1.BAS",A

Line Drawing the old fashioned way

10 'Printing Boxes the old fashioned way, one character at a time. 20 ' 30 'PrintTopLine: 40 I=0 50 WHILE I<10 60 PRINT CHR$(218); 'PrintUpperLeftCorner 70 J=0 80 WHILE J < 6 90 PRINT CHR$(196); 'PrintTopBar x 6 100 J=J+1 110 WEND 120 PRINT CHR$(191); 'PrintUpperRightCorner 130 I=I+1 140 WEND 150 ' 160 'PrintMiddleLine: 170 I=0 180 WHILE I<10 190 PRINT CHR$(179);" ";CHR$(179); 'prints vertical bars & spaces 200 I=I+1 210 WEND 220 ' 230 'PrintLowerLine: 240 I=0 250 WHILE I < 10 260 PRINT CHR$(192); 'BottomLeftCorner 270 J=0 280 WHILE J<6 290 PRINT CHR$(196); 'PrintBottomBar x 6 300 J=J+1 310 WEND 320 PRINT CHR$(217); 'PrintBottomRightCorner 330 I=I+1 340 WEND 350 END 360 '--------------------------- 370 'Embedded Commands: 380 ' save"lindraw2.bas",a 390 ' cls:list 10-150 'print upper line 400 ' cls:list 150-220 'print middle line 410 ' cls:list 220-360 'print bottom line 420 ' cls:list 360-420 'embedded commands

Foreign Language Assistance

The next four programs alter the function keys to assist with writing in foreign languages.

G E R M A N

10 'Configure Function Keys for umlaut vowels 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(142) 'umlaut A 40 KEY 2, CHR$(143) 'umlaut a 50 KEY 3, CHR$(255) 'left blank 60 KEY 4, CHR$(137) 'umlaut e 70 KEY 5, CHR$(255) 'left blank 80 KEY 6, CHR$(139) 'umlaut i 90 KEY 7, CHR$(153) 'umlaut O 100 KEY 8, CHR$(148) 'umlaut o 110 KEY 9, CHR$(154) 'umlaut U 120 KEY 10, CHR$(129) 'umlaut u 130 ' run"ascii.bas 'for other chr$(???) values 140 ' save"german.bas",a

F R E N C H

10 'Configure Function Keys for French writing 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(130) 'e accent (aigu) 40 KEY 2, CHR$(133) 'a grave 50 KEY 3, CHR$(151) 'u grave 60 KEY 4, CHR$(131) 'a circonflexe 70 KEY 5, CHR$(136) 'e circonflexe 80 KEY 6, CHR$(140) 'i circonflexe 90 KEY 7, CHR$(147) 'o circonflexe 100 KEY 8, CHR$(150) 'u circonflexe 110 KEY 9, CHR$(135) 'c cedille 120 KEY 10, CHR$(128) 'C cedille 130 ' run"ascii.bas 'for other chr$(???) values 140 ' save"french.BAS",a

S P A N I S H

10 'Configure Function Keys for Spanish writing 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(160) 'a accent 40 KEY 2, CHR$(130) 'e accent 50 KEY 3, CHR$(161) 'i accent 60 KEY 4, CHR$(162) 'o accent 70 KEY 5, CHR$(163) 'u accent 80 KEY 6, CHR$(173) 'upside down exclamation point 90 KEY 7, CHR$(168) 'upside down question mark 100 KEY 8, CHR$(164) 'n tilde 110 KEY 9, CHR$(165) 'N tilde 120 KEY 10, CHR$(255) 'reserved for the peso 130 ' run"ascii.bas 'for other chr$(???) values 140 ' save"spanish.bas",a

C O O K I N G

10 'Configure Function Keys for writing recipes 20 CLS:KEY ON:LOCATE ,,,0,7 30 KEY 1, CHR$(160) 'a accent (voila) 40 KEY 2, CHR$(130) 'e accent 50 KEY 3, CHR$(241) 'plus or minus 60 KEY 4, CHR$(247) 'approximately equal 70 KEY 5, CHR$(164) 'n tilde 80 KEY 6, CHR$(173) 'upside down exclamation point 90 KEY 7, CHR$(168) 'upside down question mark 100 KEY 8, CHR$(171) 'one half 110 KEY 9, CHR$(172) 'one fourth 120 KEY 10, CHR$(248) 'degrees 130 ' run"ascii.bas 'for other chr$(???) values 140 ' save"cooking.bas",a

Go to TOP of Page
Back to GW-BASIC Table of Contents
Back to GW-BASIC Index
Hosted by www.Geocities.ws

1