Keyboard - accessibilitysoftwarehub/OpenSourceWindowsGazeControl GitHub Wiki

General Information

Name: Keyboard

Description: Keyboard displayed on screen and uses button pressing to send key choices to be used by the system.

Purpose: Accepts user input on keyboard and sends it to the system as sendKeys.

Full Description: The form contains lists of strings for each button on the keyboard. With an exception for the buttons that will not change between keyboards. Each list of strings is assigned a corresponding button on the keyboard. Buttons such as Space, backspace, tab and such do not change as they are visible on all keyboards. On opening the keys are all resized and renamed to fit properly on screen. KeyboardView is a variable that controls which slot in the list will be displayed. When a button is pressed the keyboard will send string into SendKeys. When the abc button is pressed it changes the value of keyboardView and reassigns all the buttons to show the string within the next slot of the list.

Note: The labels on the buttons displayed in the designer are not necessarily correct on runtime. They are all overwritten on form_load. if you are planning on changing the order of buttons do this through the actual code not the designer. There are comments on the page indicating the rows and are correctly ordered so it shouldn't cause too much of a problem.

Method Descriptions

Keyboard Initialises variables. Creates panels to cover the toolbar. This is because there was an issue with the toolbar becoming unresponsive when the keyboard is open. This overrides that issue.

Form2_Load Sets keyboard view to the default buttons. It begins to resize all the buttons and move them into the correct spaces dynamically. Creates lists of keyboards. If you want to add a new keyboard quickly you would do it here. You would just add 2 more entries into each string list with your new values and add your new options to button 1. You would also need to adjust the KeyboardAmount variable so your new keyboards will be accessable through the 'abc' button.

rename_buttons() This method changes the displayed strings on each button when the keyboard is changed. Each button has tis keys stripped before being added. This is because sendKeys requires brackets around certain keys that we don't want displayed. It also resizes the font on the keyboard so the whole word is displayed when viewing keyboards like the fourth one that has whole words instead of characters.

strip_Keys() Uses regex to remove all extra characters needed for sendKeys that we don't want displayed.

IsTaskbarVisible() Returns if the taskbar is currently visible on screen so it can be accounted for when placing and resizing.

buttonClicker(String[] key, Button button) Changes the background colour of the button that has been pressed. Sends the key from the entered list to sendkeys then wait for a brief delay before changing the background colour of the button back to black. This version of the method is for the buttons that have a list of options e.g the 'a' button is also used for 'A', '@' and 'F11'.

buttonClicker(String key, Button button) This version only accepts one string for the buttons that remain the same on every version of the keyboard. e.g the space button or enter.

button#_Click() This method calls the correct buttonClicker and sends in the corresponding list of strings in. Buttons 4, 8 and 10 are an exceptions to this.

button4_Click Button 4 changes the location of the keyboard to either the bottom or the top of the screen. It checks the current location, swaps it then changes the icon to have the arrow pointing the correct direction. When moving to the bottom of the screen it will also check if the taskbar is visible on screen and account for this when positioning the keyboard.

button8_Click This is the shift button. It will increase or decrease the keyboardView by 1. If shift is not selected it will highlight the button and move keyboardView up buy one, if it has already been selected it will decrease. The variable cap indicates if it has been selected or not. It will then rename all the buttons.

button10_Click This button is for changing the keyboardView by two, mainly to swap between letters and numbers. It will increment by 2 and then mod by the totatl keyboardAmount. This stops keyboardView from going to high and causing errors when it tries to access non-existance slots in key lists. It will then rename the buttons.