Executable installer http://EmpowermentZone.com/msenv2005.exe Zip archive http://EmpowermentZone.com/msenv2005.zip Reading by word (Control+RightArrow or Control+LeftArrow, or the equivalent of JAWSKey+RightArrow or JAWSKey+LeftArrow) now uses default JAWS scripts, which read smartly when punctuation or math symbols are embedded in a word. Fixed the Toggle Punctuation script, JAWSKey+GraveAccent so that it works with JAWS 10 as well. Fixed the executable installer so that it should correctly associate the scripts with either VS 2005 or 2008. Added a tutorial on building a "fruit basket" program in C# using the scripts. I wrote the tutorial a couple years ago and have now included it as the last section of the HTML documentation, msenv2005.htm, which is opened automatically at the end of the installation process. I included it, not to teach C#, but to give someone a jump start on understanding how VS can be used with the scripts to layout a GUI form. The scripts include several layout helper commands for positioning or sizing controls. Given recent interest in this topic, I am also pasting the tutorial below. Please understand that I was no expert on either VS or C# when I wrote the tutorial, but wanted to help others with the knowledge I had gained by then. Regards, Jamal Tutorial on Building a Fruit Basket Program in C# By Jamal Mazrui October 5, 2008 CONTENTS Introduction Starting the Project Adding Controls to the Form Completing Layout Creating Event Handlers in Code Running the Program ---------- Introduction Note that this tutorial assumes that JAWS scripts for Visual Studio have been installed, either with the executable installer at http://EmpowermentZone.com/msenv2005.exe or manually with the zip archive at http://EmpowermentZone.com/msenv2005.zip On the Blind Programming list, ProgrammingBlind@xxxxxxxxxxxxx we developed specifications for a sample program with a graphical user interface (GUI) that could be implemented in various languages. It became known as a "fruit basket" program. The purpose is to help teach people how to code a GUI program in a particular language. Someone considering the language can examine the code and evaluate the syntax and other development steps involved in accordance with his or her own knowledge, skills, and preferences. By running the program, one can also make observations as an end-user, evaluating such aspects as the size, speed, and accessibility of the program. By consensus, the specifications for a fruit basket program may be stated approximately as follows. The program is a dialog box with at least a textbox, listbox, and two buttons. The user can type the name of a fruit, e.g., "apple", in the textbox. When the Add button is activated, the fruit is copied into the listbox and the textbox is cleared to be ready for another entry. When the Delete button is activated, the currently focused fruit in the listbox, or basket, is removed. For accessibility, static labels should be associated with the textbox and listbox, since these controls do not have captions like buttons. Keyboard users will also appreciate a unique hot key for each control. Making Add the default button allows a fruit to be added by simply pressing Enter after typing its name. An error message alerts the user if Add is pressed without a fruit in the textbox or Delete is pressed without a fruit in the listbox. ---------- Starting the Project Let us create a fruit basket program with C# 2005 or 2008. Launch the Visual Studio (VS) development environment through the Windows Start/Programs menu. Close the Start Page with Control+F4. Begin a new project with File/New Project or Control+Shift+N. After VS creates an initial folder and files for the project, it will probably leave focus in the Form Designer. If not, you can get there by first invoking Solution Explorer from the View menu. Another method is the two chord sequence of Control+W (for window) followed by the letter s (for Solution Explorer). Down arrow to the form1.cs file and press Enter to load this file into the Code Editor and activate the Form Designer for defining the controls through menu choices. The View menu lets you navigate between the Form Designer and Code Editor. Also, F7 goes to the Code Editor and Shift+F7 goes to the Form Designer. ---------- Adding Controls to the Form We will add controls to the form, set properties for each, and then complete the layout in a subsequent round of development. Press Control+W followed by x to invoke the Toolbox. Press Control+Home to go to the first item and then down arrow to Label and press Enter. A label control is placed on the form and focus moves there. Press F4 to invoke the Properties Window. Focus is probably in the Text property. If not, press Control+Home to go to the first item and down arrow to Text. You may need to press right arrow to expand the Appearance related properties in order to get to Text. Press Tab to go to the textbox for changing the value from the "label1" default. Replace it with the "&Fruit:" string. The initial ampersand will make Alt+F a hot key to go to the textbox to be associated with this label. You may notice that the SayLine command, JAWSKey+UpArrow still reads the previous value. This is erroneous. Press Shift+Tab to return to the property list, and you should then hear the new value spoken as the current value of the Text property. Press Escape to dismiss the Properties Window. Invoke the Toolbox again with the sequence Control+W, x or with another hot key, Alt+X, which lets you pick from a standard listbox that supports initial character navigation. Choose the Textbox control, e.g., by pressing the letter t until you get there if you used the Alt+X hot key. You do not need to change any of its properties from the default values. Now place another label control on the form and change its text to the "&Basket:" string. You can get to the Properties Window with F4 again, or use another hot key, Alt+Enter, which lets you pick from a standard listbox. Choose a listbox control to be placed on the form. Finally, add three button controls, making their Text property "&Add", "&Delete", and "&Quit", respectively. You have now placed all the controls on the form. ---------- Completing Layout Let us adjust the layout in accordance with Microsoft user interface guidelines. Tab until you hear label1 as the focused control. a padding of 14 pixels should exist between the controls and the inside borders of the form. So, press right arrow until you hear "Left 14" as the horizontal coordinate of the upper left corner of this label control. Then press down arrow until you hear "Top 14" as the vertical coordinate. You can review the current position by pressing the Center key on the numeric keypad, which should say "Left 14, Top 14." Press Tab once to set focus to textBox1. A control should be 6 pixels to the right of its label. You can go back to label1 and press Alt+Center to hear the coordinates of the lower right corner of the control. The textbox should be positioned 6 pixels further in the horizontal direction. Tab back to textBox1 and press right arrow until you hear a value equal to the right coordinate of label1 plus 6. Now press down arrow until 14 is the top coordinate. label1 and textBox1 have the same top coordinate. This is actually not the optimal alignment, however, because the text entered into textBox1 will be lower than the text of the label, i.e., the "&Fruit:" string. Through experience, we can tell you that label1 should be moved down 3 pixels in order for the baseline of its text to be the same as characters entered into textBox1. So, Shift+Tab back to label1 and press down arrow 3 times until you hear "Top 17." Now tab a couple times to set focus to label2. Press down arrow until it has a top coordinate of 17 like label1. A control other than a label should be separated by 8 pixels if it is within the same group of controls. A keyboard shortcut is available that saves you from doing the arithmetic and incremental positioning to achieve this. Press Alt+LeftArrow to set the separation between the current control and the previous one to its left. JAWS prompts for the number of pixels for separation and offers a default value of 8. Press Enter to accept this. label2 is moved to the right until it is separated by exactly 8 pixels from textBox1. Now press Tab to set focus to listBox1. Its text will be aligned with label2, i.e., the "&Basket:" string, if its top coordinate is moved to 15, that is, 2 pixels above its label. Do this with the up and down arrow keys. Then press Alt+LeftArrow to position listBox1 horizontally. Replace the default of 8 with 6 since that is the recommended distance between a label and its associated control. Tab to button1. Press Alt+UpArrow as a shortcut for setting the distance between this control and the previous one above it. Press Enter to accept 8 pixels below listBox1. Use the left and right arrow keys to set the left coordinate of button1 to 14 so it is against the left border of the form except for padding. Since button1 is now directly under label1, more separation exists between these controls because the listbox has a grater height than a label. Tab to button2. Press Alt+LeftArrow and Enter to separate it by 8 pixels from button1. Press Alt+Shift+UpArrow as a shortcut to set its top coordinate to the same as the previous control, button1. Similarly, position button3 8 pixels to the right and with the same top coordinate. Tab to form1. Its left and top padding is 14 pixels, but its right and bottom padding is probably more than that. Press Alt+End and then Enter to accept 14 as the right padding. Similarly, press Alt+PageDown and Enter to accept 14 as the bottom padding. These shortcut keys can be reviewed in the virtual buffer by pressing Insert+H for hot key help. We are nearly done with layout. Press F4 or Alt+Enter for the Properties Window of form1. Set Text to "Fruit Basket", which will be the title of the dialog. Set StartPosition to CenteronScreen, a choice in a list of possible values. Set AcceptButton to button1 and set CancelButton to button3. The AcceptButton of the form is activated by pressing Enter on any control except another button. The CancelButton is activated by pressing Escape. So, Add will be the default action, and Escape will cancel the dialog, and thus, the fruit basket program. ---------- Creating Event Handlers in Code We still need to add code so the buttons do something. Tab to button1. Press Enter to edit the event handler code for the default event, which is the Click event. Enter the following code within the button1_Click method: if (textBox1.Text.Length == 0) { MessageBox.Show ("No fruit to add!", "Alert"); } else { listBox1.Items.Add (textBox1.Text); listBox1.SelectedIndex = listBox1.Items.Count - 1; textBox1.Clear (); } The code adds a fruit to the basket or presents an alert if no fruit had been typed in the textbox. The textbox is cleared so another fruit can be added. Press Shift+F7 to invoke the Form Designer again. Tab to button2 and press Enter to edit its default event code, inserting the following: int i = listBox1.SelectedIndex; int iCount = listBox1.Items.Count; if (iCount == 0) { MessageBox.Show ("No fruit to delete!", "Alert"); } else { listBox1.Items.RemoveAt (i); iCount = listBox1.Items.Count; if (i == iCount) i--; if (i >= 0) listBox1.SelectedIndex = i; listBox1.Focus (); } The code deletes the currrent fruit in the basket or presents an alert if the basket is empty. Some commands ensure that another fruit will become focused in the basket. Now go to the code for the button3 event, and insert the following: Application.Exit(); ---------- Running the Program Press Control+Shift+S to save all changes. Run the program by pressing F5. Try adding a fruit to the basket. Add a couple more. Then tab to the basket and delete a fruit by pressing Alt+D. Try pressing Alt+F to jump to the textbox or Alt+B to jump to the basket. Press Escape or Alt+Q to quit the program. __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind