• Aucun résultat trouvé

Scrolling Through Windows

Dans le document til Smalltalk (Page 97-102)

IIiiiIiIJ cl.assWorkspace

3.3 MANIPULATING WINDOWS

3.3.4 Scrolling Through Windows

It is often impossibletodisplay all of the contents of a text document within a window on the display. Consequently, only a portion of the contents of a document may be visible at anyone time. The portion of a text that is visible may be changed by moving or scrolling the text up and down through the window. In this way, we can systematically view all of the text. All windows in which text can be entered and edited, for example Workspace, System Workspace, and System Transcript windows, arc scrollable.

Smalltalk uses scroll bars to control the portion of a text document that is visible in a window. The scroll bar is an area to theleftof the active text window. Fig. 3.11 shows the scroll bar to the left of a Workspace window. Scroll bars are only visible when the cursor is inside an active scrollable window.

Within the scroll bar is a gray scroll bar marker that provides visual cues about the text being displayed. More specifically, the length of the marker indicates what proportion of the document is visible within the window, and the position of the marker indicates which part of the document is being displayed. For example, in Fig. 3.11, the scroll bar marker is

Chapter 3 An Introduction to the Smalltalk User Interface 81

at the top of the scroll bar, indicating that the initial part of the text document is being displayed. The height of the scroll bar marker is only a fraction of the height of the scroll bar, indicating that the text document is several times larger than the portion displayed in the window.

Scroll Bar Marker

Scroll Bar

Smalltalk uses to control h.'lt portion of a text documentIS visible in a ·indow, The scroll bar is an area to the left of an active text window, Scroll bars are only visible when the cursor is inside an active scrollable ...indo...

Within the scroll bar is

~

scroll bar marker, The length and position of the scroll bar marker provide visual cues as to the proportion of the document visible within the window and to the part of the document th.'lt is &;pl.3.yed,

Figure 3.11 Organization of scrollahle windows.

In Fig. 3.12, the height of the scroll bar marker is equal to the height of the scroll bar, indicating that the visible text is all of the text document - as would be the case when the text was initially entered.

~::lItalk

u,e, ,croil'::" to

co~i;~

~

portion of a text document i, vi,ible in a window.

Ii

:::

I j ~

l : . - - - - J

Figure 3.12 Height of scroll bar marker indicates that document is completely visible within the window.

Finally, in Fig. 3.13, the position of the scroll bar is at the bottom of the scroll bar region, indicating that the visible portion of the text is at the end of the text document. The

'.:~

height of the scroll bar as compared to the height of the scroll bar region indicates that the visible text is only a small portion of the complete document.

The length and position of the scroll b·ar marker l provide visual cues as to the proportion of the ~:k.:~~.:

document visible within the window and to the part of the document that is displayed.

When the marker is at the top of the scroll barJthe initial portion of the text document is being displayed. When the marker is at the bottom of the scroll barJthe final portion of the text document is being displayedA,

~:

Figure 3.13 Position of scroll bar marker indicates displayed text is at the end of the document.

Scrolling Operations

There are three possible scrolling operations. Text may eitherbescrolled up or down one or more lines at a time or, alternatively, a specific section of the document can be selected.If the cursor is moved to the vicinity of the scroll bar, three different cursor shapes can be obtained. When the cursor is just to the right of the scroll bar marker, an upward-pointing half arrow is seen. Moving the cursor further to the left, a horizontal-pointing arrow is obtained. Finally, when the cursor is to the left of the scroll bar marker, a downward-pointing half arrow is seen.

Scrolling Forwards and Backwards

Scrolling text forwards and backwards is achieved with a simple selection using the respective up and down half arrow cursors. The cursor is moved into the area necessary to acquire the up or down arrow shaped cursor and then the selection is confirmed (by clicking the red button). The text will scroll up or down as requested. The amount scrolled is controlled by the vertical position of the cursor within the scroll bar region when the selection is made. The line of text nearest the cursor becomes the top line in the window if scrolling forwards or the bottom line if scrolling backwards. When scrolling forwards, larger scroll increments are obtained by selecting scrolling with the cursor toward the bottom of the scroll bar region. Note that experience is needed to familiarize yourself with scrolling. The most obvious problem at the beginning is that the scrolling direction is usually the opposite of that expected.

Chapter 3 An Introduction to the Smalltalk User Interface 83

Smalltalk uses • to control what portion ot a text doclJmentIS visible in a \.,..indo\.'...

The scroll bar is an area to the lett of an active text window. Scroll bars are only visible ....·hen the cursor is inside an active scrollable window.

In Fig. 3.14, the up arrow cursor is being displayed. Selecting in this situation will scroll the text in the window such that the line nearest the cursor will become the top line in the updated window - in this case, the line beginning "Within the scroll bar. ..." Note that the text is scrolled toward the end of the file by the up arrow cursor. This is counter intuitive.

I

:1:111

Within the scroll bar is a scroll bar marker.

:m

The length and position of the scroll bar marker i:::...

!:.~ ... ~ ...:..

provide visual cues as to the proportion of the :

:~~~::::~~~~;~i~:::::=::J

Figure 3.14 Scrolling forwards through a document.

In Fig. 3.15, the down arrow cursor is being displayed. Selecting in this situation will scroll the text in the window such that the line nearest the cursor will become the bottom line in the updated window - in this case, the line beginning with "document visible within ...". Text is scrolled toward the beginning of the file by the down arrow cursor.

The length and position

ot

the scroll bar m.3.rker provide visu.3.1 cues as to the proportion of the document visible within the wind,)'.... and to the p.3.rt of the document that is displayed.

When the m.3.rkeris at the top of the scroll bar, the initial portion of the text document is being displayed. When the marker is at the bottom of the scroll bar, the final portion ot the text document is being displayed.

Figure 3.15 Scrolling backwards through a document.

Jumping to a Specific Section of a Document

Two techniques are provided for moving quickly to an absolute position within a text document using the horizontal cursor. The first involves positioning the horizontal arrow cursor at a height within the scroll bar that reflects the portion of the text document you wish to view and selecting with the red button. For example, in Fig. 3.16, the horizontal cursor is positioned approximately in the middle of the scroll bar. Selecting at this point will display text from the middle of the document into the window.

When the marker is at the top of the scroll barI the initial portion of the text document is being displayed. When the marker is at the bottom of the scroll barI the final portion of the text document is being displayed.

....

'::, .':

..;

'..:

Figure 3.16 Jumping to a specified position within a document.

Alternatively, the scroll bar marker can be dragged to a desired position within the scroll bar. This is achieved using the horizontal arrow cursor and an extended selection. First, the horizontal cursor is obtained and moved within the scroll bar. When the red button is held down and moved up and down within the scroll bar, the scroll bar marker moves with the cursor. The scroll bar marker can now be dragged to the desired position within the scroll bar region. Notice that the scroll bar marker now moves up and down as the horizontal cursor is moved up and down. As it is dragged, the text displayed in the window changes.

The scroll bar marker is dragged until the desired text is displayed within the window.

Releasing the red button confirms the selection.

Gain some experience scrolling through text documents. Activate the System Workspace window. Move through the text using all three types of scrolling operations.

3.4 EDmNG TEXT

Text editing operations can be applied to any window in which text may be entered and evaluated. This includes Workspace, System Workspace, and System Transcript windows.

To illustrate the Smalltalk text manipulation facilities, we will enter and edit some text in a workspace window.

Chapter 3 An Introduction to the Smalltalk User Interface 85

Dans le document til Smalltalk (Page 97-102)