Next: , Previous: , Up: Display   [Contents][Index]

37.14 Scroll Bars

Normally the frame parameter vertical-scroll-bars controls whether the windows in the frame have vertical scroll bars, and whether they are on the left or right. The frame parameter scroll-bar-width specifies how wide they are (nil meaning the default). See Layout Parameters.

Function: frame-current-scroll-bars &optional frame

This function reports the scroll bar type settings for frame frame. The value is a cons cell (vertical-type . horizontal-type), where vertical-type is either left, right, or nil (which means no scroll bar.) horizontal-type is meant to specify the horizontal scroll bar type, but since they are not implemented, it is always nil.

You can enable or disable scroll bars for a particular buffer, by setting the variable vertical-scroll-bar. This variable automatically becomes buffer-local when set. The possible values are left, right, t, which means to use the frame’s default, and nil for no scroll bar.

You can also control this for individual windows. Call the function set-window-scroll-bars to specify what to do for a specific window:

Function: set-window-scroll-bars window width &optional vertical-type horizontal-type

This function sets the width and type of scroll bars for window window.

width specifies the scroll bar width in pixels (nil means use the width specified for the frame). vertical-type specifies whether to have a vertical scroll bar and, if so, where. The possible values are left, right and nil, just like the values of the vertical-scroll-bars frame parameter.

The argument horizontal-type is meant to specify whether and where to have horizontal scroll bars, but since they are not implemented, it has no effect. If window is nil, the selected window is used.

Function: window-scroll-bars &optional window

Report the width and type of scroll bars specified for window. If window is omitted or nil, the selected window is used. The value is a list of the form (width cols vertical-type horizontal-type). The value width is the value that was specified for the width (which may be nil); cols is the number of columns that the scroll bar actually occupies.

horizontal-type is not actually meaningful.

Function: window-scroll-bar-width &optional window

This function returns the width in pixels of window’s vertical scrollbar. window must be a live window, and defaults to the selected window.

If you don’t specify these values for a window with set-window-scroll-bars, the buffer-local variables scroll-bar-mode and scroll-bar-width in the buffer being displayed control the window’s vertical scroll bars. The function set-window-buffer examines these variables. If you change them in a buffer that is already visible in a window, you can make the window take note of the new values by calling set-window-buffer specifying the same buffer that is already displayed.

User Option: scroll-bar-mode

This variable, always local in all buffers, controls whether and where to put scroll bars in windows displaying the buffer. The possible values are nil for no scroll bar, left to put a scroll bar on the left, and right to put a scroll bar on the right.

Function: window-current-scroll-bars &optional window

This function reports the scroll bar type for window window. If window is omitted or nil, the selected window is used. The value is a cons cell (vertical-type . horizontal-type). Unlike window-scroll-bars, this reports the scroll bar type actually used, once frame defaults and scroll-bar-mode are taken into account.

Variable: scroll-bar-width

This variable, always local in all buffers, specifies the width of the buffer’s scroll bars, measured in pixels. A value of nil means to use the value specified by the frame.

Next: , Previous: , Up: Display   [Contents][Index]