Livecode Wiki
Advertisement

A Message sent to a field, scrollbar, or group when the user drags the scrollbar thumb or when a text selection causes a field to scroll. If there is a message handler by the same name in the message path, then it will be executed.

Message[]

Syntax:

scrollbarDrag <newPosition>

The parameter <newPosition> is the new position of the scrollbar thumb. This parameter is passed only if the object is a scrollbar.

If the select command is used to select text within a scrolling field, and this causes the field to scroll to bring the selected text into view, a scrollbarDrag message is sent to the field.

Message handler[]

Examples:

on scrollbarDrag newValue                           -- display current line number
  put newValue div the textHeight of me + 1 into field "Line Number"
end scrollbarDrag

Use the scrollbarDrag Message handler to respond to the user dragging the scrollbar thumb: for example, to update a counter on the card.

If the user clicks one of the arrows or the gray region of the scrollbar, and the appropriate message is not handled anywhere in the message path, a scrollbarDrag message is sent. In other words, you can use a scrollbarDrag handler to handle all scrollbar movements.

See also: scrollbarBeginning & selected.

Advertisement