More and more blind or visually impaired people are using computers and entering the work force. Programs that are not accessible to the blind will not benefit this part of the population. In many situations in the United States, the law requires that work places accommodate the special needs of the disabled. This includes computer software. It is, therefore, necessary for software to be written in a way that the blind can use it. As a blind person, myself, and one experienced with using BASIC, I am offering this article to show programmers some simple and doable ways to make their software accessible to the blind.
I can say with confidence that these techniques do work. I've tested programs employing them on WindowEyes, my screen reader, and I've had other blind people test them with other screen readers, including JAWS, one of the most commonly-used screen readers. In all cases, the BASIC programs are very accessible.
In this article, Just BASIC is referred to as JB, Liberty BASIC, LB< and Run BASIC, RB. In addition, since screen readers already do well reading web browsers, the web-based platform, Run BASIC, receives less attention here. What is discussed concerning JB and LB can easily be applied to RB.
Finally, before getting going, it must be noted that the term "blind" refers to many different types of conditions. I am totally blind, which means I have no light perception. Actually, I have no eyes. They are both prosthetic. My computer needs, then, are different from someone who has limited vision. Nonetheless, writing software that is accessible for the totally blind will cover all types of blindness.
How Screen Readers Work
A blind person may use text-to-speech technology to have the computer read the screen. One may also use a refreshable Braille display, which turns the text on the screen into raised dots of magnetic pins or the sort. However the information is handled, the principles are the same. Screen readers read text, not graphics or designs.
Another aspect of screen readers has to do with the mouse. Since the mouse moves around here and there with little orientation outside of the screen, screen readers replace mouse controls with keyboard commands. One uses complex sets of hot keys to move the mouse pointer around. Often, the mouse pointer, then, can be used to locate things on the screen to read.
This information can lead one to some very logical conclusions. First, complex graphics and animations are not recognizable to those totally blind. Obviously, video games, then, would be impossible to make accessible at this time in earth’s history unless a blind character was designed who would have special sonar powers. Nonetheless, my focus here is on making programs accessible that a blind person might actually use, like one for data entry at a job.
Next, consider how keying around the screen with the mouse pointer to look for useful text can take time. As a result, blind people really like keyboard shortcuts and hot keys. A program can still have mouse-driven functions for sighted users. There should also be keyboard short-cuts one can learn to quickly get things done.
Programming with the Blind in Mind
It is now time to consider how to write programs that the blind can use easily. The main principle to keep in mind is simplicity. If you can write a program that mainly just uses the main window, that’s perfect. That window is easily searchable by using just the arrow keys or ctrl-f for string searches. Data can be entered with the “input” or “input$” commands, and screen readers handle that excellently. It is also easy to use the input$(1) system so one simply presses certain keys for things to happen. If a program is only going to be used by the blind, this may be enough for good programming. Otherwise text windows and text editor windows are about as accessible, if not, more, depending on what you are doing.
It can also be helpful to have sound effects now and then to tell a blind person what is happening. I wrote a program designed to help the blind search the Greek and Hebrew Biblical texts easily, using JB. I recorded a Wave file of my turning pages in a book which would be heard when the program is searching the Bible files for hits. When all the hits are found and displayed, a trumpet fanfare plays. The sound effects made it so I wouldn’t have to sit in front of the computer browsing the screen while waiting until a search was done. I could just sit back and relax, following the sounds. With LB's ability to handle DLL calls, MIDI beeps and sounds could be included in a program and be more space efficient than Wave files in certain situations. A program could be written so that sound effects could be turned on or off if desired.
In addition, there is a speech dll for LB that will convert any string to speech. You can find it at http://basic.wikispaces.com/SpeechLibrary and it works well. You can add a speech option to programs you write.
The controls for windows like comboboxes, listboxes, textboxes, radiobuttons, etc., are easily recognizable by screen readers. As the arrow keys move the cursor through a list, the screen reader reads the items. Even text entered into a graphics window via the “\” command is recognized well, but the blind person must key the mouse pointer to the message. Text that is converted to bitmap files or sprites is not recognizable by screen readers and should only be used for programs not intended for use by the blind.
Where accessibility becomes a problem is when the focus must be set on a graphics window for mouse and/or Inkey$ work. The Inkey$ option is nice for the blind because it does allow one to control the computer through key strokes. If, however, there is a combobox on the screen that a blind person needs to access, the focus often returns right back to the graphics area before the key-driven mouse pointer can do very much. It begins to feel as if the computer has Attention deficit Disorder. This is where a little creative coding must be done, but it is not difficult. I even retrofitted LB’s Piano 6 to get around this problem, and I’m not even the one who originally wrote the program.
The program must be written so the focus can be changed to either the combobox or the graphics window. In the place in the program where all the Inkey$ work happens, a hot key must be provided to transfer focus out of the graphics window. An easy way to do this is with a variable you might call, fc, for focus. When fc = 0, the focus is on the graphics window. When fc = 1, the focus is on the combobox. First, then, it must be established at the very beginning of the program, before any windows open, that fc =0. Then, a command for Inkey$ might read:
IfInkey$= “ “ then fc =1
This sets the space bar as the hot key to remove the focus from the graphicbox. Any place where the focus is to be set on the graphics window, then, is coded this way, adjusting only for whatever might be happening in the graphics window:
If fc =0then#window.graphicbox “setfocus”
#window.graphicbox"when leftButtonDown [branchLabelA]"#window.graphicbox"when leftButtonUp [branchLabelB]"#window.graphicbox"when leftButtonMove [branchLabelC]"#window.graphicbox"when characterInput [branchLabelD]"Else#window.combobox “setfocus”
Endif
Of course, if no mouse activity is needed, the button moving commands wouldn't be there. When fc = 0, then the focus is on the graphicbox. When fc = 1, the focus is on the combobox. Since the only options for fc are 0 and 1, this coding structure is fine.
Finally, there must be a way to return the focus to the graphicbox. To do this, one can place a button near the combobox with a message on it like “select” or “choose.” A blind person can use tab or shift-tab to move over to that button. Clicking that button would take the program to a branch label that, among anything else that must be done, sets fc to equal 0.
You can actually test this keyboard access, yourself, with your own keyboard. I tried my modified Piano6 without my screen reader running, and, while I didn’t have a clue which instrument I was choosing, I was able to freely move about the list and choose whatever item.
I must also mention a most obvious way to make things accessible. The "run" command lets one run other programs in the computer. One could have some information saved as a text document and then have BASIC open that file in NotePad, which is highly accessible. It's a good last resort option.
Conclusion
The information here is not intended to solve every possible accessibility problem. The solutions offered may not work in every case. You may think of other ideas that work better. What I want most is for the principles behind these ideas to be in your mind as you write programs. The blind can greatly benefit from well-written software. JB, LB, and RB can be used to write such well-written software. It is my challenge, then, that if a program you write might possibly be used by a blind person, the program should be written to be accessible for such a person.
If you wish more direct assistance in making your software accessible to the blind, you may contact me to work out an arrangement. I'll make it affordable and practical. (raymcal@att.net
Code
'BASIC Rules'A blind-accessible graphics analyzer.'Colored writing is covered by a box (tinted glass) with various colors and rules invoked.'Notice all the keyboard commands.'The main window, "\" messages, statictext, and combobox are all screen-reader friendly.'The blind user uses the space bar to lock focus on combobox for rule change.'The announcement about this is white on white, only visible to screen readers.'Main window print-out lists colors as drawn and RGB values after rule change.'A ding confirms that RGB print-out happened in main window.'Status line at bottom of graphicbox tells what's presently happening.'Rule "CopyPen (Over)" turns the colored box into an rGB color testing lab.cls[SetVariables]
test =0dim rule$(16)dim rnum(16)dimname$(7)dim color(3)
fc =0'Focus control variable
rule =1
choice =1name$(1)="red."name$(2)="green."name$(3)="blue."name$(4)="cyan."name$(5)="yellow."name$(6)="magenta."name$(7)="all colors."
color(1)=255
color(2)=255
color(3)=255
rgb$ ="100"[readRuleNameData]for k =1to16read a, a$
rnum(k)= a
rule$(k)= a$
next k
'Window setupWindowWidth=DisplayWidthWindowHeight=DisplayHeightstatictext#g.s,"Choose Rule",10,505,300,100combobox#g.c, rule$(),[select],400,505,300,200graphicbox#g.g,0,0,1333,500button#g.b,"Select",[choice], ul,900,550,100,80open"BASIC Rules"forwindowas#g
#g.s "!font 20"#g.c "font 20"#g.b "!font 20"#g.c "select ";rule$(1)#g "trapclose [quit]"[work]'Graphicbox message setup#g.g "place 0 0 ; Color Black ; BackColor Black ; down ;BoxFilled 1332 200"#g.g "font 40 70 ; down ; place 0 70 ; Color Red ; BackColor Green"#g.g "\Red on green"#g.g "place 0 140 ; down ; Color 255 160 0 ; BackColor Blue ; font 40 70"#g.g "\Orange on blue"#g.g "place 680 70 ; down ; Color Yellow ; BackColor 140 0 200 ; font 40 70"#g.g "\Yellow on purple"#g.g "place 680 140 ; down ; Color 100 100 100 ; BackColor White ; font 40 70"#g.g "\Grey on white"#g.g "place 0 250 ; down ; Color Black ; BackColor White ; font 20"#g.g "\Press A for control of all colors of the tinted glass."#g.g "\ R for red; G, green; B, blue; C, cyan; Y, yellow; M, magenta."#g.g "\ 0-9 to change selected color(s) to 1 of 10 values from 0-255."#g.g "\ Arrow Keys to advance color(s) 1 notch at a time."#g.g "\ P to print to screen current RGB list."#g.g "\ Alt-F4 to close window."'Make accessibility line visible only to screen readers.#g.g "color white ; backcolor white ; down"#g.g "\ Space Bar for blind-accessible combobox."#g.g "flush messages"#g.g "\"#g.g "flush change"gosub[printOut]gosub[ruleChange][keyCheck]'Get computer watching for key-presses.scan'Blind-accessibility focus control.if fc =0then#g.g "setfocus"#g.g "when characterInput [keyWork]"else#g.c "setfocus"endifwait[keyWork]'Act according to key presses.
k$ =Inkey$
key =asc(k$)selectcasecase k$ =" "
fc =1'Allow blind users to have focus locked on combobox.case(key >=48)and(key <=57)'Number key control.'Change only the selected values.for k =1to3ifmid$(rgb$,k,1)="1"then color(k)=int(val(k$)*(255/9))next k
gosub[ruleChange]'Arrow key control.case(asc(right$(k$,1))=_VK_LEFT)or(asc(right$(k$,1))=_VK_DOWN)
show =0'Status line and screen don't update if no change.for k =1to3ifmid$(rgb$,k,1)="1"then color(k)= color(k)-1if color(k)<0then
color(k)=0else
show =1endifnext k
if show =1thengosub[ruleChange]case(asc(right$(k$,1))=_VK_RIGHT)or(asc(right$(k$,1))=_VK_UP)
show =0for k =1to3ifmid$(rgb$,k,1)="1"then color(k)= color(k)+1if color(k)>255then
color(k)=255else
show =1endifnext k
if show =1thengosub[ruleChange]'Set which RGB value(s) of tinted glass cover to change.caseupper$(k$)="R"
rgb$ ="100"
choice =1gosub[ruleChange]caseupper$(k$)="G"
rgb$ ="010"
choice =2gosub[ruleChange]caseupper$(k$)="B"
rgb$ ="001"
choice =3gosub[ruleChange]caseupper$(k$)="C"
rgb$ ="011"
choice =4gosub[ruleChange]caseupper$(k$)="Y"
rgb$ ="110"
choice =5gosub[ruleChange]caseupper$(k$)="M"
rgb$ ="101"
choice =6gosub[ruleChange]caseupper$(k$)="A"
rgb$ ="111"
choice =7gosub[ruleChange]'Send RGB print-out to main window with confirming ding.caseupper$(k$)="P"playwave"nofile.wav", async
gosub[printOut]endselectgoto[keyCheck][select]'Access data from combobox.#g.c "selectionindex? rule"gosub[ruleChange]'Blind accessibility focus control.if fc =0then#g.g "setfocus"#g.g "when CharacterInput [keyWork]"else#g.c "setfocus"endifwait'Button action[choice]
fc =0goto[select]wait[quit]close#g
printprint"Press Alt-F4 to end program."wait[ruleChange]'Remove what graphics will be changed.#g.g "delsegment change ; redraw"'Determine which rule to use.#g.g "rule ";rnum(rule)'Change message colors as directed.#g.g "Color ";color(1);" ";color(2);" ";color(3)#g.g "BackColor ";color(1);" ";color(2);" ";color(3)#g.g "place 0 0 ; size 1 ; down ; BoxFilled 1332 200"'Revise status line at bottom of graphicbox.
message$ ="Rule = ";rule$(rule) ; ", color ";color(1); " ";color(2);" ";color(3);", and changing ";name$(choice)#g.g "font 20 ; place 0 485 ; Color 0 0 128 ; BackColor White ; down"#g.g "\" ; message$
'Flush new material.#g.g "flush change"'Blind accessible focus control.if fc =0then#g.g "setfocus"#g.g "when characterInput [keyWork]"else#g.c "setfocus"endifreturn'Set in main window RGB values of messages through tinted glass.[printOut]'Notify differently for first print-out.if test =0thenprint"Original print-out, actual color values."elseprintprint"Rule = ";rule$(rule) ; ", glass color ";color(1); " ";color(2);" ";color(3)endif
test =1'Use col$ function to get pixel values.print" Red: ";col$(7,40)print" Orange: ";col$(5,110)print" Yellow: ";col$(705,40)print" Green: "; col$(6,40)print" Blue: ";col$(4,110)print" Purple: ";col$(706,40)print" White: ";col$(755,110)print" Grey: ";col$(756,110)print" Black: ";col$(622,110)'Blind accessibility focus control.if fc =0then#g.g "setfocus"#g.g "when characterInput [keyWork]"else#g.c "setfocus"endifreturn[listOfRulesWithCodeNumbers]data10,"NotXOrPen, (XOr)",7,"XOrPen",9,"MaskPen",8,"NotMaskPen"data3,"MaskNotPen",5,"MaskPenNot",15,"MergePen",2,"NotMergePen"data12,"MergeNotPen",14,"MergePenNot",6,"Not",13,"CopyPen (Over)",data4,"NotCopyPen",1,"Black",16,"White",11,"NoOperation"'Function col$ -- col$(x,y) finds RGB value for pixel x,y.function col$(colorx,colory)#g.g "getbmp gpv ";colorx;" ";colory;" 1 1"bmpsave"gpv","getpvaluetemp.bmp"open"getpvaluetemp.bmp"forinputas#gpv
colorresult$ =input$(#gpv,lof(#gpv))close#gpv
ifasc(mid$(colorresult$,29,1))=32then
red =asc(mid$(colorresult$,69,1))
green =asc(mid$(colorresult$,68,1))
blue =asc(mid$(colorresult$,67,1))endif
col$ =str$(red)+" "+str$(green)+" "+str$(blue)endfunction
BASIC for Blind Users
By Ray McAllisterBASIC for Blind Users | Introduction | How Screen Readers Work | Programming with the Blind in Mind | Conclusion | Code
Introduction
More and more blind or visually impaired people are using computers and entering the work force. Programs that are not accessible to the blind will not benefit this part of the population. In many situations in the United States, the law requires that work places accommodate the special needs of the disabled. This includes computer software. It is, therefore, necessary for software to be written in a way that the blind can use it. As a blind person, myself, and one experienced with using BASIC, I am offering this article to show programmers some simple and doable ways to make their software accessible to the blind.
I can say with confidence that these techniques do work. I've tested programs employing them on WindowEyes, my screen reader, and I've had other blind people test them with other screen readers, including JAWS, one of the most commonly-used screen readers. In all cases, the BASIC programs are very accessible.
In this article, Just BASIC is referred to as JB, Liberty BASIC, LB< and Run BASIC, RB. In addition, since screen readers already do well reading web browsers, the web-based platform, Run BASIC, receives less attention here. What is discussed concerning JB and LB can easily be applied to RB.
Finally, before getting going, it must be noted that the term "blind" refers to many different types of conditions. I am totally blind, which means I have no light perception. Actually, I have no eyes. They are both prosthetic. My computer needs, then, are different from someone who has limited vision. Nonetheless, writing software that is accessible for the totally blind will cover all types of blindness.
How Screen Readers Work
A blind person may use text-to-speech technology to have the computer read the screen. One may also use a refreshable Braille display, which turns the text on the screen into raised dots of magnetic pins or the sort. However the information is handled, the principles are the same. Screen readers read text, not graphics or designs.
Another aspect of screen readers has to do with the mouse. Since the mouse moves around here and there with little orientation outside of the screen, screen readers replace mouse controls with keyboard commands. One uses complex sets of hot keys to move the mouse pointer around. Often, the mouse pointer, then, can be used to locate things on the screen to read.
This information can lead one to some very logical conclusions. First, complex graphics and animations are not recognizable to those totally blind. Obviously, video games, then, would be impossible to make accessible at this time in earth’s history unless a blind character was designed who would have special sonar powers. Nonetheless, my focus here is on making programs accessible that a blind person might actually use, like one for data entry at a job.
Next, consider how keying around the screen with the mouse pointer to look for useful text can take time. As a result, blind people really like keyboard shortcuts and hot keys. A program can still have mouse-driven functions for sighted users. There should also be keyboard short-cuts one can learn to quickly get things done.
Programming with the Blind in Mind
It is now time to consider how to write programs that the blind can use easily. The main principle to keep in mind is simplicity. If you can write a program that mainly just uses the main window, that’s perfect. That window is easily searchable by using just the arrow keys or ctrl-f for string searches. Data can be entered with the “input” or “input$” commands, and screen readers handle that excellently. It is also easy to use the input$(1) system so one simply presses certain keys for things to happen. If a program is only going to be used by the blind, this may be enough for good programming. Otherwise text windows and text editor windows are about as accessible, if not, more, depending on what you are doing.
It can also be helpful to have sound effects now and then to tell a blind person what is happening. I wrote a program designed to help the blind search the Greek and Hebrew Biblical texts easily, using JB. I recorded a Wave file of my turning pages in a book which would be heard when the program is searching the Bible files for hits. When all the hits are found and displayed, a trumpet fanfare plays. The sound effects made it so I wouldn’t have to sit in front of the computer browsing the screen while waiting until a search was done. I could just sit back and relax, following the sounds. With LB's ability to handle DLL calls, MIDI beeps and sounds could be included in a program and be more space efficient than Wave files in certain situations. A program could be written so that sound effects could be turned on or off if desired.
In addition, there is a speech dll for LB that will convert any string to speech. You can find it at http://basic.wikispaces.com/SpeechLibrary and it works well. You can add a speech option to programs you write.
The controls for windows like comboboxes, listboxes, textboxes, radiobuttons, etc., are easily recognizable by screen readers. As the arrow keys move the cursor through a list, the screen reader reads the items. Even text entered into a graphics window via the “\” command is recognized well, but the blind person must key the mouse pointer to the message. Text that is converted to bitmap files or sprites is not recognizable by screen readers and should only be used for programs not intended for use by the blind.
Where accessibility becomes a problem is when the focus must be set on a graphics window for mouse and/or Inkey$ work. The Inkey$ option is nice for the blind because it does allow one to control the computer through key strokes. If, however, there is a combobox on the screen that a blind person needs to access, the focus often returns right back to the graphics area before the key-driven mouse pointer can do very much. It begins to feel as if the computer has Attention deficit Disorder. This is where a little creative coding must be done, but it is not difficult. I even retrofitted LB’s Piano 6 to get around this problem, and I’m not even the one who originally wrote the program.
The program must be written so the focus can be changed to either the combobox or the graphics window. In the place in the program where all the Inkey$ work happens, a hot key must be provided to transfer focus out of the graphics window. An easy way to do this is with a variable you might call, fc, for focus. When fc = 0, the focus is on the graphics window. When fc = 1, the focus is on the combobox. First, then, it must be established at the very beginning of the program, before any windows open, that fc =0. Then, a command for Inkey$ might read:
This sets the space bar as the hot key to remove the focus from the graphicbox. Any place where the focus is to be set on the graphics window, then, is coded this way, adjusting only for whatever might be happening in the graphics window:
Of course, if no mouse activity is needed, the button moving commands wouldn't be there. When fc = 0, then the focus is on the graphicbox. When fc = 1, the focus is on the combobox. Since the only options for fc are 0 and 1, this coding structure is fine.
Finally, there must be a way to return the focus to the graphicbox. To do this, one can place a button near the combobox with a message on it like “select” or “choose.” A blind person can use tab or shift-tab to move over to that button. Clicking that button would take the program to a branch label that, among anything else that must be done, sets fc to equal 0.
You can actually test this keyboard access, yourself, with your own keyboard. I tried my modified Piano6 without my screen reader running, and, while I didn’t have a clue which instrument I was choosing, I was able to freely move about the list and choose whatever item.
I must also mention a most obvious way to make things accessible. The "run" command lets one run other programs in the computer. One could have some information saved as a text document and then have BASIC open that file in NotePad, which is highly accessible. It's a good last resort option.
Conclusion
The information here is not intended to solve every possible accessibility problem. The solutions offered may not work in every case. You may think of other ideas that work better. What I want most is for the principles behind these ideas to be in your mind as you write programs. The blind can greatly benefit from well-written software. JB, LB, and RB can be used to write such well-written software. It is my challenge, then, that if a program you write might possibly be used by a blind person, the program should be written to be accessible for such a person.
If you wish more direct assistance in making your software accessible to the blind, you may contact me to work out an arrangement. I'll make it affordable and practical. (raymcal@att.net
Code
BASIC for Blind Users | Introduction | How Screen Readers Work | Programming with the Blind in Mind | Conclusion | Code