User Tools

Site Tools


prop_xorigin.htm
Navigation:  Language Reference > App C - PROP: Runtime Properties > Complete Property List >====== PROP:Xorigin and PROP:YOrigin ====== Previous pageReturn to chapter overviewNext page

(how much a window or control has been scrolled)

Attributes of a SHEET, IMAGE, or LIST control (which have horizontal and/or vertical scrollbar(s)) that sets or retrieves how much the control has been scrolled. XORIGIN (PROP:XOrigin) specifies how much the control has scrolled in the X direction. YORIGIN (PROP:YOrigin) specifies how much the control has scrolled in the Y direction. As the example shows below, these properties are also valid on a WINDOW.

This property returns the value that CHOICE( ) would return for the first visible row of a referenced list box. This property allows you to calculate the current position of the highlighted row, (e.g. CHOICE(?List) - ?List{PROP:YOrigin} + 1)

You can also set this property using the following syntax:

?List {PROP:YOrigin} = n

where n is the topmost visible row to scroll the list box to. The runtime library will then adjust the given value to show as many rows as possible. For example, if

n + (?List{PROP:Items} - 1) > ?List{PROP:LineCount}, n is changed to ?List{PROP:LineCount} - (?List{PROP:Items} - 1)

If n <;= 0, n is changed to 1.

Example

PROGRAM

MAP

END

S STRING(20)

Window WINDOW('Caption'),AT(,,400,250),FONT('MS Sans Serif',8,,FONT:regular)|

                       ,IMM,VSCROLL, STATUS,SYSTEM,GRAY,CENTER

       ENTRY(@S20),AT(10,100),USE(S,,?S1),SCROLL

       ENTRY(@S20),AT(10,500),USE(S,,?S2),SCROLL

       ENTRY(@S20),AT(10,900),USE(S,,?S3),SCROLL

      END

y1      UNSIGNED

y2      UNSIGNED

Wy1     UNSIGNED

Wy2     UNSIGNED

Control SIGNED

 CODE

 OPEN(Window)

 ACCEPT

 CASE EVENT()

 OF EVENT:Selected

  Control = SELECTED()

  IF Control

    y1 = Control {PROP:yPos}

    y2 = y1 + Control {PROP:Height}

    Wy1 = 0{PROP:YOrigin}                          !read Yorigin

    Wy2 = Wy1 + 0 {PROP:ClientHeight}

    IF y1 <; Wy1

     0{PROP:YOrigin} = CHOOSE (y1 <; 20, 0, y1 - 20)

    ELSIF y2 > Wy2

     0{PROP:YOrigin} = Wy1 + y2 - Wy2 + 20         !set Yorigin

    END

   END

  END

 END

 CLOSE(Window)

See Also: PROP:LineCount

prop_xorigin.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1