API reference › Rendering & Viewer
rasGetScrollPos
The classic Win32 scrollbar-model quintet: current
int32_t __stdcall rasGetScrollPos(IPGC CachePtr, BOOL32 Vertical, uint32_t PageNum);
BOOL32 __stdcall rasGetScrollRange(IPGC CachePtr, BOOL32 Vertical, int32_t* Max, int32_t* SmallChange, int32_t* LargeChange);
uint32_t __stdcall rasGetScrollLineDelta(IPGC CachePtr, BOOL32 Vertical);
BOOL32 __stdcall rasSetScrollLineDelta(IPGC CachePtr, BOOL32 Vertical, uint32_t Value);
TUpdScrollbar __stdcall rasScroll(IPGC CachePtr, BOOL32 Vertical, int32_t ScrollCode, int32_t* ScrollX, int32_t* ScrollY);
function rasGetScrollPos(CachePtr: IPGC; Vertical: LongBool; PageNum: Cardinal): Integer; stdcall;
function rasGetScrollRange(CachePtr: IPGC; Vertical: LongBool; var Max, SmallChange, LargeChange: Integer): LongBool; stdcall;
function rasGetScrollLineDelta(CachePtr: IPGC; Vertical: LongBool): Cardinal; stdcall;
function rasSetScrollLineDelta(CachePtr: IPGC; Vertical: LongBool; Value: Cardinal): LongBool; stdcall;
function rasScroll(CachePtr: IPGC; Vertical: LongBool; ScrollCode: Integer; var ScrollX, ScrollY: Integer): TUpdScrollbar; stdcall;
Purpose. The classic Win32 scrollbar-model quintet: current position, range/page/line sizes, line-delta configuration, and the actual scroll-command dispatcher that applies a SB_*-style code.
Description. MAJOR VERIFIED FINDING: rasSetScrollLineDelta's stored value is never consulted by rasScroll or rasGetScrollRange — both hardcode a line-step of 40 pixels instead. rasScroll's SB_LINEUP/SB_LINEDOWN (ScrollCode 0/1) branches are literally Dec(ScrollY, 40)/Inc(ScrollY, 40) (and the horizontal equivalents) — never C.ScrollDeltaV/C.ScrollDeltaH, the exact fields rasSetScrollLineDelta writes and rasGetScrollLineDelta faithfully reads back. Likewise, rasGetScrollRange's SmallChange output is hardcoded to 40, not C.ScrollDeltaV/H. The net effect: calling rasSetScrollLineDelta changes what rasGetScrollLineDelta reports, but has zero effect on actual scroll-wheel/line-button behavior — a genuine write/no-effect split, distinct from (but in the same "configuration accepted, never wired to behavior" family as) other dropped-parameter findings in this SDK. rasScroll's SB_PAGEUP/ SB_PAGEDOWN (2/3) use the real viewport Height/Width (matching LargeChange, which is genuinely computed from the live viewport size); SB_TOP/SB_BOTTOM (6/7, vertical only — no horizontal equivalents exist) jump to 0/maxV. rasGetScrollPos has a PageNum-aware overload: with PageNum ≥ 1 it returns the scroll position that would bring that page's top into view (vertical only — horizontal always returns 0 in this mode); with PageNum = 0 it returns the current raw ScrollX/ScrollY.
Parameters.
| Parameter | Description |
|---|---|
CachePtr | Target page cache. |
Vertical | Selects the vertical vs. horizontal scroll axis. |
PageNum | *(GetScrollPos only)* ≥ 1: scroll position for that page's top (vertical only). 0: current raw position. |
Max, SmallChange, LargeChange | *(GetScrollRange)* Max/LargeChange genuinely computed from content/viewport size; SmallChange always 40, ignoring rasSetScrollLineDelta. |
Value | *(SetScrollLineDelta)* Stored and faithfully echoed by the getter — but never consulted by rasScroll. |
ScrollCode | A SB_*-style command (0=LineUp, 1=LineDown, 2=PageUp, 3=PageDown, 6=Top, 7=Bottom vertical-only; 4/5 thumbtrack/position pass ScrollX/Y through directly). |
ScrollX, ScrollY | In/out: input value used for thumbtrack codes; output is always the new, range-clamped position. |
Return value. rasGetScrollPos: the position. rasGetScrollRange/ rasSetScrollLineDelta: True if CachePtr resolves. rasGetScrollLineDelta: the stored (behaviorally-inert) delta. rasScroll: TUpdScrollbar(1) (update requested) if CachePtr resolves; TUpdScrollbar(0) otherwise.
C# (P/Invoke)
public static extern int rasGetScrollPos(IntPtr CachePtr, [MarshalAs(UnmanagedType.Bool)] bool Vertical, uint PageNum);
Rasterizer/Rendering
rasGetScrollPos
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.