UI module

send_scroll

procedureextensionexperimentalsince 0.31.0Source

Queue wheel or trackpad scrolling; positive dy scrolls the content up (towards its end).

Example↗
ui := headless(.{ width = 200, height = 100 });
defer free_ui(*ui);
build := (u: *UI_State) {
    for scroll(.{ height = 100 }) { for 0..29 label(tprint("line %", it)); }
};
frame(*ui, *ui, build);
send_mouse_move(*ui, 50, 50);
send_scroll(*ui, 0, -3);
frame(*ui, *ui, build);
send_scroll :: (ui: *UI_State, dx: float, dy: float)

Queue wheel or trackpad scrolling; positive dy scrolls the content up (towards its end).

Parameters

ui: *UI_State
the UI to queue the event on.
dx: float
horizontal scroll in points.
dy: float
vertical scroll in points.
Example↗
ui := headless(.{ width = 200, height = 100 });
defer free_ui(*ui);
build := (u: *UI_State) {
    for scroll(.{ height = 100 }) { for 0..29 label(tprint("line %", it)); }
};
frame(*ui, *ui, build);
send_mouse_move(*ui, 50, 50);
send_scroll(*ui, 0, -3);
frame(*ui, *ui, build);

See also