This is the legacy 4D documentation web site. Documentations are progressively being moved to developer.4d.com |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v20 R7
OBJECT SET SCROLL POSITION
|
OBJECT SET SCROLL POSITION ( * ; object {; vPosition {; hPosition}}{; *} ) | ||||||||
Parameter | Type | Description | ||||||
* | Operator |
![]() |
If specified, object is an object name (string) If omitted, object is a table, a field or a variable |
|||||
object | Form object |
![]() |
Object name (if * is specified) or Table or field or variable (if * is omitted) | |||||
vPosition | Longint |
![]() |
Line number to display or Vertical scrolling in pixels (pictures) | |||||
hPosition | Longint |
![]() |
Column number to display (list box) or Horizontal scrolling in pixels (pictures) | |||||
* | Operator |
![]() |
Display of line (and column if the hPosition parameter is passed) in first position after scroll | |||||
The OBJECT SET SCROLL POSITION command allows scrolling the contents of several types of objects: the lines of a subform, of a list form (displayed using the MODIFY SELECTION or DISPLAY SELECTION commands), or of a hierarchical list, the rows and columns of a list box or even the pixels of a picture.
Note: Scrolling via programming remains possible even if scrollbars have been hidden in the form.
If you pass the first optional * parameter, you indicate that the object parameter is the name of a subform, a hierarchical list, a list box object or a picture field/variable (in this case, pass a string in object). If you do not pass anything in this parameter, you indicate that the object parameter is a table (list form table or subform table), a variable (ListRef of a hierarchical list or list box or picture) or a field.
The vPosition parameter can be used to specify the number of the row to display or, in the case of a picture, the vertical coordinate of the pixel to display.
If you do not pass this parameter, the command provokes the vertical scroll of lines of the list so that the first highlighted line in the list is visible. In this case, if no line is selected or if at least one selected line is already visible, no vertical scrolling is applied.
If you pass this parameter, the command provokes the vertical scroll of lines of the list so that the set line is visible (highlighted or not). If the line is already visible, the command does nothing, unless the second * parameter is passed (see below).
Note: Keep in mind that this command goes by the "standard" representation (non-hierarchical) of a list box, even if it is displayed in hierarchical mode. Therefore, the result may be different depending on whether the list box is displayed in standard or hierarchical mode (see example).
The hPosition parameter can be used in the context of a list box or a picture.
If you pass the second optional * parameter:
Note: The HIGHLIGHT RECORDS command features an optional * parameter that allows delegating scroll management to the OBJECT SET SCROLL POSITION command.
This example illustrates the difference in the way the command functions depending on whether the list box is displayed in standard or hierarchical mode:
OBJECT SET SCROLL POSITION(*;"mylistbox";4;2;*) // displays 4th row of 2nd column of list box in the first position
If this statement is applied to a list box displayed in standard mode:
... the rows and columns of the list box actually scroll:
On the other hand, if the same statement is applied to a list box displayed in hierarchical mode, the rows scroll but not the columns because the 2nd column is part of the hierarchy:
You want to scoll a picture that is included in a form variable. This montage shows the visible part of the picture as well as the point to be displayed (166 pixels vertically and 200 pixels horizontally):
To scroll the visible part and display the red point at the origin of the picture variable, you can just write:
OBJECT SET SCROLL POSITION(*;"myVar";166;200;*)
You then get the following result:
Make sure that you do not omit the second * parameter in this case, otherwise the picture will not scroll because the point defined is already displayed.
HIGHLIGHT RECORDS
LISTBOX SELECT ROW
OBJECT GET SCROLL POSITION
Product: 4D
Theme: Objects (Forms)
Number:
906
Modified: 4D v11 SQL
Modified: 4D v12
Renamed: 4D v12 (SCROLL LINES)
4D Language Reference ( 4D v20 R7)