Manipulating Cursors
The cursors used by JAWS are not as important for a regular user of the screen reader, but they are of a great importance for any JAWS Script writer as they add a lot of flexibility to what we can do with the information presented on and off the screen.
There are four cursors used by JAWS:
-
PC Cursor -- a cursor that is synchronized with the physical cursor and keyboard navigation of an active application;
-
JAWS Cursor -- a cursor that simulates mouse navigation, including mouse clicks, scrolling and by-pixel movements;
-
Invisible Cursor -- very similar to JAWS Cursor, however, does not support mouse actions, such as clicks (single and double clicks);
-
Virtual PC Cursor -- a cursor that is primarily used in HTML documents (such as in Internet Explorer).
It is crucial to be aware of the differences between these four cursors during scripting, because they behave differently and may provide you with different information every time you use them. Let's look at each of the cursors one by one.
::: {#pc-cursor}
PC Cursor
:::
When the PC Cursor is active, it will allow you to navigate only within the application window. For example, if you open Microsoft Word, you will only be able to use arrow keys, tab key and other keyboard keystrokes that are supported by Microsoft Word. You will not be able to view the information that is not directly accessible through keyboard, like ruler, toolbars or status line. Of course, you can review the status line with a JAWS keystroke (JAWSKEY + PAGE DOWN), but this is not a native Microsoft Word shortcut key and will not work if you close your screen reader.
Another good example is a window title. If you try to press UP ARROW within a Word Document, or any other application, you will never be able to get to the line that displays the title of the window. This is because applications do not give you direct keyboard access to that information, even though it is readily displayed on the screen. The JAWS keystroke JAWSKEY + T is only specific to JAWS and will not work if you shut down your screen reader.
::: {#jaws-cursor}
JAWS Cursor
:::
A JAWS Cursor, on the other hand, allows you to review the screen regardless of whether the application gives you keyboard access to the information on the screen or not. For example, if you switch to the JAWS cursor while in the Microsoft Word application and start using your arrow keys, you will notice that there is much more information available to you than before. You will find that you can now arrow up all the way to the top of the window and read the title of the application with your usual reading keystrokes (by word, by character etc).
The JAWS Cursor is very useful for JAWS scripters because it allows us to find more information about our application and apply it in our scripts. Let's say we wanted to have a keystroke to read the status line for our application. Our status line, however, is displayed two lines up from the bottom of an active window. We could have written something like this:
Script SpeakStatusLine()
Var
String sStatusLine
SaveCursor()
JAWSCursor()
RouteJAWSToPC()
JAWSPageDown()
JAWSHome()
PriorLine()
PriorLine()
Let sStatusLine = GetLine()
Say (OT_STATUS, GetLine())
RestoreCursor()
EndScript
Assign your script to a keystroke of your choice and off you go!
You probably have questions about three functions that you have seen in this script: SaveCursor(), RestoreCursor() and RouteJAWSToPC(). The first two functions are especially important to remember because they allow you to tell JAWS to return the user to whatever cursor and location they were using before they switched to the JAWS Cursor. You cannot always assume that they were using PC Cursor before they turned on the JAWS Cursor, can you? SaveCursor(), therefore, tells JAWS to remember the active cursor and RestoreCursor() will return the users back to that cursor. It is always a good idea to use these functions in your scripts whenever you switch between various cursors. Usually you will use SaveCursor() immediately before activating a different cursor and RestoreCursor() once you completed your intended action.
::: {#restricting-jaws-cursor}
Restricting JAWS Cursor
:::
When sighted users review the screen with a mouse, they can position it anywhere on the screen and perform clicks at different points of it. The same can be achieved using the JAWS Cursor.
Because the screen can contain a lot of information from different windows, this could easily confuse a non-sighted person. To deal with this problem JAWS has a concept known as "cursor restrictions". With the JAWS Cursor or Invisible Cursor turned on, we can use JAWSKEY + R to toggle between:
-
Application window restriction -- JAWS Cursor will only be allowed to move within the window of the active application;
-
Current window restriction -- JAWS will only be allowed to move within the boundaries of a current window (note this can be different from an application window);
-
Frame restriction -- the JAWS Cursor will only be allowed to move within the boundaries of the user-defined window/regions, called frames;
-
Unrestricted -- the JAWS Cursor will be allowed to move anywhere on the screen, just like a physical mouse does.
When you script, it is useful that you make sure that your JAWS or Invisible Cursor is at the location where you want it to be. Otherwise, you may be clicking on the wrong button or reading wrong information. The quickest way to check whether your JAWS Cursor follows the PC Cursor is to use the function RouteJAWSToPC().
One last note on the JAWS Cursor. Please remember that when you move the JAWS Cursor in your scripts or with the arrow keys, the actual physical mouse pointer will also move on the screen. This concept will be more clear and make more sense when we discuss the Invisible Cursor below.
::: {#invisible-cursor}
Invisible Cursor
:::
The Invisible Cursor in many ways is identical to the JAWS Cursor. The major difference between the two is that the Invisible Cursor does not allow us to perform mouse clicks. However, all the other reviewing functionality of the JAWS Cursor is also applicable to an invisible cursor. We can also restrict the movements of the Invisible Cursor in exactly the same way we do with the JAWS Cursor (even the keystroke JAWSKEY + R is the same).
You may be wondering about the necessity of having both JAWS Cursor and Invisible Cursor since they act almost identically! Have you heard sighted people say that something changed on the screen as soon as they pointed their mouse at button or a picture? Did you know that some buttons or graphics change their color when the mouse pointer rests on them? Did you know that the shape of the mouse pointer itself can change if the application is doing something? Well, guess what! It can make our life difficult when we try to find the color of the graphic or even to label one for later use in our scripts. This is where Invisible Cursor can become useful.
Let's say that we have an application with a graphic that change its color or characteristics when a mouse pointer is moved over it. We would like to be able to label that graphic. If we use the JAWS Cursor to do this and label the graphic with a mouse pointer on it, JAWS may have problems recognizing that graphic later when the mouse pointer is not positioned on that graphic.
Here is the possible algorithm that we could use to make that graphic recognizable:
-
Turn on the JAWS Cursor
-
Move to the graphic that you would like to label or get an information about
-
Get the information that you need (for example, retrieve the color of the graphic)
-
Switch to Invisible Cursor
-
Route Invisible Cursor to the JAWS Cursor
-
Switch to JAWS Cursor and move your arrow key away from the graphic
-
Switch back to Invisible Cursor and get the information about the graphic again (for example, retrieve its color)
-
Compare the information that you've got before with the information that you obtained with Invisible Cursor and see if there are any differences.
The scenario can get even more complicated if your graphic will look differently after the user clicks on it with a single click or double click.
In basic terms, think of an Invisible Cursor as a copy of the JAWS cursor which is not displayed on the screen but can navigate just like a mouse pointer, but without an ability to perform mouse clicks. Also keep in mind that the JAWS Cursor will follow the movements of a physical mouse, whereas the Invisible Cursor will not.
::: {#virtual-pc-cursor}
Virtual PC Cursor
:::
The Virtual PC Cursor is completely independent of the screen and of any application. The idea behind this type of cursor is to enable JAWS to create its own navigation interface regardless of what is displayed on the screen. Two major examples of the applications where Virtual PC cursor is used are Internet Explorer and JAWS screen sensitive help. Whenever you press JAWSKEY + F1 to see the information about current application screen or shortcut keys, JAWS creates its internal area (known as the Virtual Viewer) that allows you to browse through the information as if you were viewing a regular web page. Try, for instance, to press JAWSKEY + F1 in Microsoft Word application or a document area, and you will find a lot of interesting and useful information about the currently-active document as well as some global settings for Microsoft Word. In addition, notice that in addition to regular text, JAWS is able to display links to other related information to make it look like you are browsing a web page.
::: {#summary}
Summary
:::
In this document we have discussed the four cursors that are available in JAWS: PC Cursor, JAWS Cursor, Invisible Cursor and Virtual PC Cursor. It is important that you understand the purpose of each of these cursors, because they behave differently from each other as well as provide different information about the application and the screen. When scripting, take extra care to make sure that you are in fact using the cursor that you intend to use, otherwise your scripts may report wrong information to the user. Remember to save the active cursor before you switch to a new one (using the SaveCursor() function), so that you can return the user to where they were before your script executed.